Skip to content

Using DateTime in Primary Key for Time Series #55954

Closed Answered by den-crane
marioaae asked this question in Q&A
Discussion options

You must be logged in to vote

My understanding is that it is NOT recommended to use high-cardinality fields as primary keys, for example, unique_ids as this would create too many granules as explained in this article:

No, nothing like this. Number of granules is not related to columns in keys, it's defined by a number of rows. 1 granule=8192 rows.
High cardinal rows are not recommended at the leading positions of the primary key , because they de-valuate other columns in the primary key, BUT only if you are omitting these high cardinal columns in the where section with equality expression. Also they may reduce compression rate.

So in the case order by (event_id, city, region, country) I would bluntly suggest to chan…

Replies: 4 comments 5 replies

Comment options

You must be logged in to vote
0 replies
Answer selected by marioaae
Comment options

You must be logged in to vote
1 reply
@den-crane
Comment options

Comment options

You must be logged in to vote
2 replies
@den-crane
Comment options

@marioaae
Comment options

Comment options

You must be logged in to vote
2 replies
@ayush-san
Comment options

@ceevaaa
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants