You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cassandra.apache.org by Alain RODRIGUEZ <ar...@gmail.com> on 2013/08/21 18:18:12 UTC

Re: how-to scan a table using CQL3

Hi, I am sorry about digging this up but I was in search of this kind of
information and read this thread.

How to make sure that the first rowkey you select has the smaller token ? I
mean when you perform "select rowkey from my_table limit N;" can you have
any data with any token or is data token ordered by default ?

I tried it in dev and I have data with bigger token, but also with smaller
token so I would have to do :

 select rowkey from my_table where token(rowkey)
> token(last_rowkey_returned) limit N;

But also :

 select rowkey from my_table where token(rowkey) <
token(last_rowkey_returned) limit N;

How to make sure you scan all your data, and only once, with CQL3 ? Am I
misunderstanding or missing something ?

Alain

2013/5/14 aaron morton <aa...@thelastpickle.com>

> select rowkey from my_table limit N;
> while some_row_is_returned do
>  select rowkey from my_table where token(rowkey) >
> token(last_rowkey_returned) limit N;
>
> That should work for you.
>
> See
> http://www.datastax.com/docs/1.2/cql_cli/using/paging#non-ordered-partitioner-paging
>
> Cheers
>
>    -----------------
> Aaron Morton
> Freelance Cassandra Consultant
> New Zealand
>
> @aaronmorton
> http://www.thelastpickle.com
>
> On 11/05/2013, at 9:23 AM, Thorsten von Eicken <tv...@rightscale.com> wrote:
>
> Thanks, this is interesting, but if I'm not mistaken, Astyanax uses CQL2.
> I'm trying to find a CQL3 solution on top the binary protocol. There has to
> be a way to do this in CQL3...?
> Thorsten
>
>
>
> On 5/10/2013 1:33 PM, Keith Wright wrote:
>
> What you are proposing should work and I started to implement that using
> multiple threads over the token ranges but decided instead to use to
> Astyanax's read all rows recipe as it does much of that already.  It
> required some work to convert the composite CQL2 format returned from
> Astayanx into what is expected for CQL3 but did work.  Here's an outline
> of what you would do:
>
>
>
>
>

Re: how-to scan a table using CQL3

Posted by Alain RODRIGUEZ <ar...@gmail.com>.
Furthermore I think this is already available on the 1.2.8. Not tested yet.


2013/8/26 Keith Wright <kw...@nanigans.com>

> I noticed in C* 2.0 that it will support automatic paging for CQL queries (
> https://issues.apache.org/jira/browse/CASSANDRA-4415).  I'm wondering if
> this will make future table scans as simple as "select * from <table>".
>  Anyone try this yet?
>
> From: Alain RODRIGUEZ <ar...@gmail.com>
> Reply-To: "user@cassandra.apache.org" <us...@cassandra.apache.org>
> Date: Thursday, August 22, 2013 11:01 AM
> To: "user@cassandra.apache.org" <us...@cassandra.apache.org>
> Subject: Re: how-to scan a table using CQL3
>
> Oops, I made a mistake thought I was paging on partition key when I
> actually was paging on columns. No need of token and columns are ordered.
> Sorry about bothering the ones who read this, it was a PEBCAK.
>
> Alain
>
>
>
>
> 2013/8/21 Alain RODRIGUEZ <ar...@gmail.com>
>
>> Hi, I am sorry about digging this up but I was in search of this kind of
>> information and read this thread.
>>
>> How to make sure that the first rowkey you select has the smaller token ?
>> I mean when you perform "select rowkey from my_table limit N;" can you have
>> any data with any token or is data token ordered by default ?
>>
>> I tried it in dev and I have data with bigger token, but also with
>> smaller token so I would have to do :
>>
>>  select rowkey from my_table where token(rowkey)
>> > token(last_rowkey_returned) limit N;
>>
>> But also :
>>
>>  select rowkey from my_table where token(rowkey) <
>> token(last_rowkey_returned) limit N;
>>
>> How to make sure you scan all your data, and only once, with CQL3 ? Am I
>> misunderstanding or missing something ?
>>
>> Alain
>>
>> 2013/5/14 aaron morton <aa...@thelastpickle.com>
>>
>>> select rowkey from my_table limit N;
>>> while some_row_is_returned do
>>>  select rowkey from my_table where token(rowkey) >
>>> token(last_rowkey_returned) limit N;
>>>
>>> That should work for you.
>>>
>>> See
>>> http://www.datastax.com/docs/1.2/cql_cli/using/paging#non-ordered-partitioner-paging
>>>
>>> Cheers
>>>
>>>   -----------------
>>> Aaron Morton
>>> Freelance Cassandra Consultant
>>> New Zealand
>>>
>>> @aaronmorton
>>> http://www.thelastpickle.com
>>>
>>> On 11/05/2013, at 9:23 AM, Thorsten von Eicken <tv...@rightscale.com>
>>> wrote:
>>>
>>> Thanks, this is interesting, but if I'm not mistaken, Astyanax uses
>>> CQL2. I'm trying to find a CQL3 solution on top the binary protocol. There
>>> has to be a way to do this in CQL3...?
>>> Thorsten
>>>
>>>
>>>
>>> On 5/10/2013 1:33 PM, Keith Wright wrote:
>>>
>>> What you are proposing should work and I started to implement that using
>>> multiple threads over the token ranges but decided instead to use to
>>> Astyanax's read all rows recipe as it does much of that already.  It
>>> required some work to convert the composite CQL2 format returned from
>>> Astayanx into what is expected for CQL3 but did work.  Here's an outline
>>> of what you would do:
>>>
>>>
>>>
>>>
>>>
>>
>

Re: how-to scan a table using CQL3

Posted by Keith Wright <kw...@nanigans.com>.
I noticed in C* 2.0 that it will support automatic paging for CQL queries (https://issues.apache.org/jira/browse/CASSANDRA-4415).  I'm wondering if this will make future table scans as simple as "select * from <table>".  Anyone try this yet?

From: Alain RODRIGUEZ <ar...@gmail.com>>
Reply-To: "user@cassandra.apache.org<ma...@cassandra.apache.org>" <us...@cassandra.apache.org>>
Date: Thursday, August 22, 2013 11:01 AM
To: "user@cassandra.apache.org<ma...@cassandra.apache.org>" <us...@cassandra.apache.org>>
Subject: Re: how-to scan a table using CQL3

Oops, I made a mistake thought I was paging on partition key when I actually was paging on columns. No need of token and columns are ordered. Sorry about bothering the ones who read this, it was a PEBCAK.

Alain




2013/8/21 Alain RODRIGUEZ <ar...@gmail.com>>
Hi, I am sorry about digging this up but I was in search of this kind of information and read this thread.

How to make sure that the first rowkey you select has the smaller token ? I mean when you perform "select rowkey from my_table limit N;" can you have any data with any token or is data token ordered by default ?

I tried it in dev and I have data with bigger token, but also with smaller token so I would have to do :
 select rowkey from my_table where token(rowkey) > token(last_rowkey_returned) limit N;
But also :
 select rowkey from my_table where token(rowkey) < token(last_rowkey_returned) limit N;
How to make sure you scan all your data, and only once, with CQL3 ? Am I misunderstanding or missing something ?

Alain

2013/5/14 aaron morton <aa...@thelastpickle.com>>
select rowkey from my_table limit N;
while some_row_is_returned do
 select rowkey from my_table where token(rowkey) >
token(last_rowkey_returned) limit N;
That should work for you.

See http://www.datastax.com/docs/1.2/cql_cli/using/paging#non-ordered-partitioner-paging

Cheers

-----------------
Aaron Morton
Freelance Cassandra Consultant
New Zealand

@aaronmorton
http://www.thelastpickle.com

On 11/05/2013, at 9:23 AM, Thorsten von Eicken <tv...@rightscale.com>> wrote:

Thanks, this is interesting, but if I'm not mistaken, Astyanax uses CQL2. I'm trying to find a CQL3 solution on top the binary protocol. There has to be a way to do this in CQL3...?
Thorsten



On 5/10/2013 1:33 PM, Keith Wright wrote:
What you are proposing should work and I started to implement that using
multiple threads over the token ranges but decided instead to use to
Astyanax's read all rows recipe as it does much of that already.  It
required some work to convert the composite CQL2 format returned from
Astayanx into what is expected for CQL3 but did work.  Here's an outline
of what you would do:







Re: how-to scan a table using CQL3

Posted by Alain RODRIGUEZ <ar...@gmail.com>.
Oops, I made a mistake thought I was paging on partition key when I
actually was paging on columns. No need of token and columns are ordered.
Sorry about bothering the ones who read this, it was a PEBCAK.

Alain




2013/8/21 Alain RODRIGUEZ <ar...@gmail.com>

> Hi, I am sorry about digging this up but I was in search of this kind of
> information and read this thread.
>
> How to make sure that the first rowkey you select has the smaller token ?
> I mean when you perform "select rowkey from my_table limit N;" can you have
> any data with any token or is data token ordered by default ?
>
> I tried it in dev and I have data with bigger token, but also with smaller
> token so I would have to do :
>
>  select rowkey from my_table where token(rowkey)
> > token(last_rowkey_returned) limit N;
>
> But also :
>
>  select rowkey from my_table where token(rowkey) <
> token(last_rowkey_returned) limit N;
>
> How to make sure you scan all your data, and only once, with CQL3 ? Am I
> misunderstanding or missing something ?
>
> Alain
>
> 2013/5/14 aaron morton <aa...@thelastpickle.com>
>
>> select rowkey from my_table limit N;
>> while some_row_is_returned do
>>  select rowkey from my_table where token(rowkey) >
>> token(last_rowkey_returned) limit N;
>>
>> That should work for you.
>>
>> See
>> http://www.datastax.com/docs/1.2/cql_cli/using/paging#non-ordered-partitioner-paging
>>
>> Cheers
>>
>>    -----------------
>> Aaron Morton
>> Freelance Cassandra Consultant
>> New Zealand
>>
>> @aaronmorton
>> http://www.thelastpickle.com
>>
>> On 11/05/2013, at 9:23 AM, Thorsten von Eicken <tv...@rightscale.com>
>> wrote:
>>
>> Thanks, this is interesting, but if I'm not mistaken, Astyanax uses CQL2.
>> I'm trying to find a CQL3 solution on top the binary protocol. There has to
>> be a way to do this in CQL3...?
>> Thorsten
>>
>>
>>
>> On 5/10/2013 1:33 PM, Keith Wright wrote:
>>
>> What you are proposing should work and I started to implement that using
>> multiple threads over the token ranges but decided instead to use to
>> Astyanax's read all rows recipe as it does much of that already.  It
>> required some work to convert the composite CQL2 format returned from
>> Astayanx into what is expected for CQL3 but did work.  Here's an outline
>> of what you would do:
>>
>>
>>
>>
>>
>