3 ms·
Problem is that randomly assigned ids tend to perform sub-optimally in relational databases due to the sparse distribution screwing up row estimates and causing
by ris 8y ago
Problem is that randomly assigned ids tend to perform sub-optimally in relational databases due to the sparse distribution screwing up row estimates and causing fragmented writes to the underlying table. For this reason many people have a policy of having (nice sequential) "internal" ids and then (pseudorandom) "external" ids.
- kyrra 8y agoDepends on your database. For example, Spanner it is better to use random numbers for the primary index, as monotonically increasing ints will cause hotspots on the database. https://cloud.google.com/spanner/docs/schema-design#choosing_a_primary_key https://cloud.google.com/spanner/docs/schema-design#choosing...