You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cassandra.apache.org by Micha <mi...@fantasymail.de> on 2017/07/20 09:21:31 UTC

secondary index use case

Hi,

even after reading much about secondary index usage I'm not sure if I
have the correct use case for it.

My table will contain about 150'000'000 records (each about 2KB data).
There are two uuids used to identify a row. One uuid is unique for each
row, the other uuid is something like a groupid, which give mostly 20
records when queried.

So, if I define my primary key as (groupuuid, uuid) then:
"select * ... where groupuuid = X" gives me 0 - 20 rows

"select * ... where groupuuid = X and uuid = Y" gives me 0 | 1 row

now, sometimes I want to query only with uuid:
"select * ... where uuid = X"  to get exactly one row (without using
groupid)

Is this a good use case for a secondary index on uuid?


Thanks for helping,
 Michael






---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@cassandra.apache.org
For additional commands, e-mail: user-help@cassandra.apache.org


Re: secondary index use case

Posted by Vladimir Yudovin <vl...@winguzone.com>.
Hi,



You didn't mention your C* version, but starting from 3.4 SASI indexes are available. You can try it with SPARSE option, as uuid corresponds to only one row.



Best regards, Vladimir Yudovin, 

Winguzone - Cloud Cassandra Hosting






---- On Thu, 20 Jul 2017 05:21:31 -0400 Micha &lt;micha-1@fantasymail.de&gt; wrote ----




Hi, 

 

even after reading much about secondary index usage I'm not sure if I 

have the correct use case for it. 

 

My table will contain about 150'000'000 records (each about 2KB data). 

There are two uuids used to identify a row. One uuid is unique for each 

row, the other uuid is something like a groupid, which give mostly 20 

records when queried. 

 

So, if I define my primary key as (groupuuid, uuid) then: 

"select * ... where groupuuid = X" gives me 0 - 20 rows 

 

"select * ... where groupuuid = X and uuid = Y" gives me 0 | 1 row 

 

now, sometimes I want to query only with uuid: 

"select * ... where uuid = X" to get exactly one row (without using 

groupid) 

 

Is this a good use case for a secondary index on uuid? 

 

 

Thanks for helping, 

 Michael 

 

 

 

 

 

 

--------------------------------------------------------------------- 

To unsubscribe, e-mail: user-unsubscribe@cassandra.apache.org 

For additional commands, e-mail: user-help@cassandra.apache.org