![]() If you need a UUID key, you need a UUID key. Is there any way to remedy or are UUIDs simply not a good PK on a large, un-partitioned table? Writes will tend to be random within indexes, not appends to hot, recently accessed rows The b-tree index that implements the primary key will be 4x as large (vs a 32-bit key), taking longer to search and requiring more memory to cache. The uuid is 4 times as wide as a typical 32-bit integer synthetic key, so the row to write is 12 bytes bigger and you can fit fewer rows into a given amount of RAM It still does have a performance cost because of the need to maintain the PK, and because the inserted tuple is bigger. So I imagine that in Postgres using a UUID PK does not hurt the performance of that insert. Whereas with a sequential key the index will only be updated at the tip which will always be in memory.Īssuming that I understand the performance impact on the index correctly, is there any way to remedy that or are UUIDs simply not a good PK on a large, un-partitioned table?Īs I understand it, Postgres does not maintain row clustering on inserts As I understand it, Postgres does not maintain row clustering on inserts, so I imagine that in Postgres using a UUID PK does not hurt the performance of that insert.īut I would think that it makes the insert into the index that the primary key constraint creates much more expensive once the table is large, because it will have to constantly be read from disk to update the index on insertion of new data. In DBMS's that use clustered storage for table records it is a given that using a UUID is going to increase the cost of inserts due to having to read from disk to find the data page into which to perform the insert, once the table is too big to hold in memory. I am wondering about the performance impact of using a non-sequential UUID as the primary key in a table that will become quite large in PosgreSQL.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |