incubator-cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark <>
Subject Re: TimeUUID vs Epoch
Date Fri, 13 Aug 2010 17:10:57 GMT
On 8/13/10 10:01 AM, Sylvain Lebresne wrote:
> True, it's more annoying to do because you need to construct a UUID whose time
> part is what you need and the rest of the bytes are zeros (excepted for the
> version bit that should be one for the UUID to be valid if I remember
> correctly).
> And usually, UUID generator don't give you that, you'll have to 'do it
> yourself',
> which is annoying (but not very hard if you look a UUID version 1 layout).
> --
> Sylvain
> On Fri, Aug 13, 2010 at 6:54 PM, Mark<>  wrote:
>> On 8/13/10 9:38 AM, Sylvain Lebresne wrote:
>>> As long as time sorting is involved, you'll the same ordering if you
>>> use Epoch/Long
>>> or TimeUUID. The difference is between the ties. If when you insert
>>> two values at
>>> the exact same time, you want to have only one stay, then you want
>>> LongType.
>>> If however you don't want to merge such inserts, then you want TimeUUID
>>> since
>>> they assure you that even if generated at the exact same time, the key
>>> will be different
>>> (plus if your UUID generator is not too bad, it will give you better
>>> precision than the
>>> epoch/long one).
>>> --
>>> Sylvain
>>> On Fri, Aug 13, 2010 at 6:32 PM, Mark<>    wrote:
>>>> I'm a little confused on when I should be using TimeUUID vs Epoch/Long
>>>> when
>>>> I want columns ordered by time. I know it sounds strange and the obvious
>>>> choice should be TimeUUID but I'm not sure why that would be preferred
>>>> over
>>>> just using the Epoch stamp?
>>>> The pretty much seem to accomplish the same thing however when using
>>>> Epoch I
>>>> can easily use a start/end range for querying across times. Can this be
>>>> accomplished using TimeUUID?
>>>> Would someone also explain how TimeUUID is actually sorted? Im confused
>>>> on
>>>> how its actually compared. Thanks!
>> So long story short you can give a start/end range when using TimeUUID?
>> For example I am storing a bunch of records keyed by the current date
>> "20100813". Each column is a TimeUUID. If I wanted to get all the columns
>> that between some arbitrary time.. say 6am - 9am I can get that?
>> Using Long I can just use a start of "1281704400000000" and a finish of
>> "1281715200000000" but Im unsure of how to represent that as a TimeUUID.
Thanks for the help. Im using UUID version 1 so Ill have to look into 
how this would be accomplished. Im using the SimpleUUID ruby gem so if 
anyone knows how this is done please chime in :)

View raw message