incubator-cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jimmy Lin <y2klyf+w...@gmail.com>
Subject Re: paging through a table with timeuuid primary key
Date Wed, 02 Oct 2013 04:53:01 GMT
ok found out the problem..

i was using something like:
select * from log where token(mykey) > token(maxTimeuuid(xxxxx)) limit 100;

instead I should just simply use
select * from log where token(mykey) > token(key_from_last_result) limit
100;


the fake timeuuid although represent the time from last key, but doesn't do
anything good to the token function. The argument to the token should
really be the actual key value.


On Tue, Oct 1, 2013 at 9:32 AM, Jimmy Lin <y2klyf+work@gmail.com> wrote:

> thanks, yea i am aware of that, and have already taken care.
>
>  I just also found out a similar thread back in June
>
> http://mail-archives.apache.org/mod_mbox/cassandra-user/201306.mbox/%3CCAKkz8Q2no6oUCbWnVeoMn_YMxfH0nKpQvtYm55jmVWA2QWXSWw@mail.gmail.com%3E
>
> Somone was saying
>
>
> Long story short, using non-equal condition on the partition key (i.e. the
> first part of your primary key) is generally not advised. Or to put it
> another way, the use of the byte ordering partitioner is discouraged. But
> if you still want to use the ordering partitioner and do range queries on
> the partition key, do not use a timeuuid, because the ordering that the
> partitioner enforce will not be one that is meaningful (due to the timeuuid
> layout).
>
>
>
>
>
>
>
> So can't ues token on a timeuuid key?
>
>
>
>
>
> On Tue, Oct 1, 2013 at 9:18 AM, Jan Algermissen <
> jan.algermissen@nordsc.com> wrote:
>
>> Maybe you are hitting the problem that your 'pages' can get truncated in
>> the middle of a wide row.
>>
>> See
>> https://groups.google.com/a/lists.datastax.com/d/msg/java-driver-user/lHQ3wKAZgM4/DnlXT4IzqsQJ
>>
>> Jan
>>
>>
>>
>> On 01.10.2013, at 18:12, Jimmy Lin <y2klyf+work@gmail.com> wrote:
>>
>> > unfortunately, i have to stick with 1.2 for now for a while.
>> >
>> > So I am looking for the old fashion way to do the pagination correctly.
>> >
>> > I think i follow most of the articles on how to paging through a table,
>> but maybe have some silly gap that don't give me the correct behavior or it
>> is timeuuid not working for token function?
>> >
>> >
>> >
>> > On Tue, Oct 1, 2013 at 8:57 AM, David Ward <david@shareablee.com>
>> wrote:
>> > 2.0 has a lot of really exciting stuff, unfortunately 2.0 has a lot of
>> really exciting stuff that may increase the risk of updating to 2.0 just
>> yet.
>> >
>> >
>> > On Tue, Oct 1, 2013 at 9:30 AM, Jan Algermissen <
>> jan.algermissen@nordsc.com> wrote:
>> > Jimmy,
>> >
>> > On 01.10.2013, at 17:26, Jimmy Lin <y2klyf+work@gmail.com> wrote:
>> >
>> > > i have a table like the following:
>> > >
>> > > CREATE TABLE log (
>> > > mykey timeuuid,
>> > > type text,
>> > > msg text,
>> > > primary key(mykey, type)
>> > > );
>> > >
>> > > I want to page through all the results from the table using
>> >
>> > Have you considered the new build-in paging support:
>> >
>> >
>> http://www.datastax.com/dev/blog/client-side-improvements-in-cassandra-2-0
>> >
>> > Jan
>> >
>> > >
>> > > select * from log where token(mykey) > token(maxTimeuuid(xxxxx))
>> limit 100;
>> > >
>> >
>> >
>> > > (where xxx is 0 for the first query, and next one to be the time of
>> the mykey(timeuuid) from the last query result)
>> > >
>> > > But i seem to get random result.
>> > >
>> > > #1
>> > > is the above logic make sense for timeuuid type pagination?
>> > >
>> > > #2
>> > > when we use token in the where clase, is the result return sorted?
>> > > e.g
>> > > where token(k) > token(4) AND token(k)  < token(10) limit 3
>> > >
>> > > k=5, k=6, k=7
>> > > or
>> > > k=7, k=5, k=9
>> > >
>> > > ?
>> > >
>> > > I see lot of article use LIMIT to achieve page size, but if the
>> result is not sorted, then it is possible to miss item?
>> > >
>> > >
>> > > thanks
>> > >
>> > >
>> >
>> >
>> >
>>
>>
>

Mime
View raw message