You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cassandra.apache.org by Oleg Krayushkin <al...@gmail.com> on 2016/10/31 13:19:07 UTC

Secondary Index on Boolean column with TTL

Hi,

Is it a good approach to make a boolean column with TTL and build a
secondary index on it?
(For example, I want to get rows which need to be updated after a certain
time, but I don't want, say, to add a filed "update_date" as clustering
column or to create another table)

In what kind of trouble it could lead me?

Thanks in advance for any suggestions.

-- 

Oleg Krayushkin

Re: Secondary Index on Boolean column with TTL

Posted by Oleg Krayushkin <al...@gmail.com>.
Thanks a lot, DuyHai!

2016-10-31 19:53 GMT+03:00 DuyHai Doan <do...@gmail.com>:

> Technically TTL should be handled properly. However, be careful of expired
> data turning into tombstones. For the original table, it may be a tombstone
> on a skinny partition but for the 2nd index, it may be a tombstone set on a
> wide partition and you'll start getting into trouble when reading a
> partition with a lot of them
>
> On Mon, Oct 31, 2016 at 5:08 PM, Oleg Krayushkin <al...@gmail.com>
> wrote:
>
>> Hi, DuyHai, thank you.
>>
>> I got the idea of caveat with too low cardinality, but still wondering of
>> possible troubles at the idea to put TTL (months) on indexed column (not
>> bool, say, 100 different values of int).
>>
>> 2016-10-31 16:33 GMT+03:00 DuyHai Doan <do...@gmail.com>:
>>
>>> http://www.planetcassandra.org/blog/cassandra-native-seconda
>>> ry-index-deep-dive/
>>>
>>> See section E Caveats which applies to your boolean use-case
>>>
>>> On Mon, Oct 31, 2016 at 2:19 PM, Oleg Krayushkin <al...@gmail.com>
>>> wrote:
>>>
>>>> Hi,
>>>>
>>>> Is it a good approach to make a boolean column with TTL and build a
>>>> secondary index on it?
>>>> (For example, I want to get rows which need to be updated after a
>>>> certain time, but I don't want, say, to add a filed "update_date" as
>>>> clustering column or to create another table)
>>>>
>>>> In what kind of trouble it could lead me?
>>>>
>>>> Thanks in advance for any suggestions.
>>>>
>>>> --
>>>>
>>>> Oleg Krayushkin
>>>>
>>>
>>>
>>
>>
>> --
>>
>> Oleg Krayushkin
>>
>
>


-- 

Oleg Krayushkin

Re: Secondary Index on Boolean column with TTL

Posted by DuyHai Doan <do...@gmail.com>.
Technically TTL should be handled properly. However, be careful of expired
data turning into tombstones. For the original table, it may be a tombstone
on a skinny partition but for the 2nd index, it may be a tombstone set on a
wide partition and you'll start getting into trouble when reading a
partition with a lot of them

On Mon, Oct 31, 2016 at 5:08 PM, Oleg Krayushkin <al...@gmail.com>
wrote:

> Hi, DuyHai, thank you.
>
> I got the idea of caveat with too low cardinality, but still wondering of
> possible troubles at the idea to put TTL (months) on indexed column (not
> bool, say, 100 different values of int).
>
> 2016-10-31 16:33 GMT+03:00 DuyHai Doan <do...@gmail.com>:
>
>> http://www.planetcassandra.org/blog/cassandra-native-seconda
>> ry-index-deep-dive/
>>
>> See section E Caveats which applies to your boolean use-case
>>
>> On Mon, Oct 31, 2016 at 2:19 PM, Oleg Krayushkin <al...@gmail.com>
>> wrote:
>>
>>> Hi,
>>>
>>> Is it a good approach to make a boolean column with TTL and build a
>>> secondary index on it?
>>> (For example, I want to get rows which need to be updated after a
>>> certain time, but I don't want, say, to add a filed "update_date" as
>>> clustering column or to create another table)
>>>
>>> In what kind of trouble it could lead me?
>>>
>>> Thanks in advance for any suggestions.
>>>
>>> --
>>>
>>> Oleg Krayushkin
>>>
>>
>>
>
>
> --
>
> Oleg Krayushkin
>

Re: Secondary Index on Boolean column with TTL

Posted by Oleg Krayushkin <al...@gmail.com>.
Hi, DuyHai, thank you.

I got the idea of caveat with too low cardinality, but still wondering of
possible troubles at the idea to put TTL (months) on indexed column (not
bool, say, 100 different values of int).

2016-10-31 16:33 GMT+03:00 DuyHai Doan <do...@gmail.com>:

> http://www.planetcassandra.org/blog/cassandra-native-
> secondary-index-deep-dive/
>
> See section E Caveats which applies to your boolean use-case
>
> On Mon, Oct 31, 2016 at 2:19 PM, Oleg Krayushkin <al...@gmail.com>
> wrote:
>
>> Hi,
>>
>> Is it a good approach to make a boolean column with TTL and build a
>> secondary index on it?
>> (For example, I want to get rows which need to be updated after a certain
>> time, but I don't want, say, to add a filed "update_date" as clustering
>> column or to create another table)
>>
>> In what kind of trouble it could lead me?
>>
>> Thanks in advance for any suggestions.
>>
>> --
>>
>> Oleg Krayushkin
>>
>
>


-- 

Oleg Krayushkin

Re: Secondary Index on Boolean column with TTL

Posted by DuyHai Doan <do...@gmail.com>.
http://www.planetcassandra.org/blog/cassandra-native-secondary-index-deep-dive/

See section E Caveats which applies to your boolean use-case

On Mon, Oct 31, 2016 at 2:19 PM, Oleg Krayushkin <al...@gmail.com>
wrote:

> Hi,
>
> Is it a good approach to make a boolean column with TTL and build a
> secondary index on it?
> (For example, I want to get rows which need to be updated after a certain
> time, but I don't want, say, to add a filed "update_date" as clustering
> column or to create another table)
>
> In what kind of trouble it could lead me?
>
> Thanks in advance for any suggestions.
>
> --
>
> Oleg Krayushkin
>