What is the best approach for primary keys on Citus?
UUID: No lock required, as opposed to the Identity/Serial. But expensive in storage and eventually on queries + causes fragmentations.
Sequence - Identity Causes a bottleneck while creating an entity. Less expensive in storage and queries will be faster + no fragmentations.
If we want to be scale-ready project, will it better to work with UUID?
According to this post: https://www.cybertec-postgresql.com/en/uuid-serial-or-identity-columns-for-postgresql-auto-generated-primary-keys/
For shards it is recommended to work with UUID eventually.
How well it perform on Citus?
I'll give a schema example:
User
UserId uuid/bigint?
Device
Device Id uuid/bigint?
UserId (here for the distribution key)
In the above example, we want to distribute the user data according to the UserId, for example his Devices. What should be the primary key ids types? If UUID is the answer, should we be afraid of fragmentations in the nodes?