You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cassandra.apache.org by Shay Assulin <SH...@il.ibm.com> on 2011/02/13 15:48:47 UTC
Secondary index - keys only.
HI,
Is there a way to get only the keys of indexed rows (without getting
columns) using get_indexed_slices method?
I am using Hector to access Cassandra and I want to count rows with a
specific index - so i need to get only the keys.
I am doing the following:
n = 0
while (true) {
indexedSliceQuery.setStartKey( lastFetchedKey )
indexedSliceQuery.setReturnedKeysOnly();
indexedSliceQuery.addFilter( the indexed column EQ value )
res = indexedSliceQuery.execute();
n += res.size();
update lastFetchedKey
if (size == 0) break;
}
It looks like the time it takes to get keys are just like the time it
takes to get the entire row.
Re: Secondary index - keys only.
Posted by Jonathan Ellis <jb...@gmail.com>.
No.
On Sun, Feb 13, 2011 at 8:48 AM, Shay Assulin <SH...@il.ibm.com> wrote:
> HI,
>
> Is there a way to get only the keys of indexed rows (without getting
> columns) using get_indexed_slices method?
>
> I am using Hector to access Cassandra and I want to count rows with a
> specific index - so i need to get only the keys.
>
> I am doing the following:
>
>
> n = 0
>
> while (true) {
>
> indexedSliceQuery.setStartKey( lastFetchedKey )
>
> indexedSliceQuery.setReturnedKeysOnly();
> indexedSliceQuery.addFilter( the indexed column EQ value )
>
> res = indexedSliceQuery.execute();
> n += res.size();
> update lastFetchedKey
> if (size == 0) break;
> }
>
> It looks like the time it takes to get keys are just like the time it takes
> to get the entire row.
>
>
>
--
Jonathan Ellis
Project Chair, Apache Cassandra
co-founder of DataStax, the source for professional Cassandra support
http://www.datastax.com