> First approach:

Sounds good. 

> Second approach ( I used in production ):
If the row gets big enough this will have bad performance. 

A

-----------------
Aaron Morton
New Zealand
@aaronmorton

Co-Founder & Principal Consultant
Apache Cassandra Consulting
http://www.thelastpickle.com

On 19/12/2013, at 10:28 am, Kumar Ranjan <winnerd...@gmail.com> wrote:

> I am using pycassa. So, here is how I solved this issue. Will discuss 2 
> approaches. First approach didn't work out for me. Thanks Aaron for your 
> attention.
> 
> First approach:
> - Say if column_count = 10
> - collect first 11 rows, sort first 10, send it to user (front end) as JSON 
> object and last=11th_column
> - User then calls for page 2, with prev = 1st_column_id, column_start = 
> 11th_column and column_count = 10
> - This way, I can traverse, next page and previous page.
> - Only issue with this approach is, I don't have all columns in super column 
> sorted. So this did not work.
> 
> Second approach ( I used in production ):
> - fetch all super columns for a row key
> - Sort this in python using sorted and lambda function based on column values.
> - Once sorted, I prepare buckets and each bucked size is of page size/column 
> count. Also filter out any rogue data if needed
> - Store page by page results in Redis with keys such as 
> 'row_key|page_1|super_column' and keep refreshing redis periodically.
> 
> I am sure, there must be a better and brighter approach but for now, 2nd 
> approach is working. Thoughts ??
> 
> 
> 
> On Tue, Dec 17, 2013 at 9:19 PM, Aaron Morton <aa...@thelastpickle.com> wrote:
> CQL3 and thrift do not support an offset clause, so you can only really 
> support next / prev page calls to the database. 
> 
>> I am trying to use xget with column_count and buffer_size parameters. Can 
>> someone explain me, how does it work? From doc, my understanding is that, I 
>> can do something like,
> What client are you using ? 
> xget is not a standard cassandra function. 
> 
> Cheers
> 
> -----------------
> Aaron Morton
> New Zealand
> @aaronmorton
> 
> Co-Founder & Principal Consultant
> Apache Cassandra Consulting
> http://www.thelastpickle.com
> 
> On 13/12/2013, at 4:56 am, Kumar Ranjan <winnerd...@gmail.com> wrote:
> 
>> Hey Folks,
>> 
>> I need some ideas about support implementing of pagination on the browser, 
>> from the backend. So python code (backend) gets request from frontend with 
>> page=1,2,3,4 and so on and count_per_page=50. 
>> 
>> I am trying to use xget with column_count and buffer_size parameters. Can 
>> someone explain me, how does it work? From doc, my understanding is that, I 
>> can do something like,
>> 
>> 
>> total_cols is total columns for that key.
>> count is what user sends me. 
>> .xget('Twitter_search', hh, column_count=total_cols, buffer_size=count):
>> 
>> Is my understanding correct? because its not working for page 2 and so on? 
>> Please enlighten me with suggestions.
>> 
>> Thanks.
>> 
> 
> 

Reply via email to