cassandratimeuuid

TimeUUID vs timestamp in Cassandra?


If we can extract time from TimeUUID, does it make any sense to use timestamp as another column in Cassandra?

Also how can we extract Time from TimeUUID and make range queries (eg. Jan 2016 to May 2016) on it?


Solution

  • You don't need to store timestamp in a different column, if you have chosen to use timeuuid.

    You are looking for this:
    https://docs.datastax.com/en/cql/3.0/cql/cql_reference/timeuuid_functions_r.html

    Please take notice about the min and max. The LSB bits determine the uniqueness. i.e last 8 bits can range from 00000000 to ffffffff.

    So please prepare your range query accordingly.