tsbs icon indicating copy to clipboard operation
tsbs copied to clipboard

bigint in cassandra for timestamp

Open curlup opened this issue 6 years ago • 1 comments

Hi,

as already stated in a comment to a TS to C* comparison article,

you really don't need timestamp in C* row to be bigint

https://github.com/timescale/tsbs/blob/73ae4be837a5ae5644c1c615dc77ae0496b33392/cmd/tsbs_load_cassandra/creator.go#L57

Each cassandra row will only contain one day of values, so it's 24*60*60/10 = 8640 entries.

I suggest to use 2-byte smallint, which is 4 times smaller than 8-byte bigint.

curlup avatar Aug 10 '18 12:08 curlup

Hi @curlup . you make a good point that the bigint type and nanosecond precision may be a bit overkill. Ideally we could keep the schema flexible enough to handle at least millisecond precision, which a smallint couldn't handle in a clean way (we'd need at least 86M values per day to represent the full range of possibilities, whereas a signed smallint tops out at 32K).

We could still shave the size of the column in half and be able to use ms-precision timestamps with an integer type, which I'm definitely not opposed to exploring.

LeeHampton avatar Aug 10 '18 14:08 LeeHampton