Better HN
top
new
best
ask
show
jobs
Log in
Sign up
Better HN
Comment
by
hans_castorp
· 2y ago · 0 comments
I wonder why the size of the table with uuid7 is smaller than the one with uuid4? Both are using the uuid data type.
Comments
[–]
uhoh-itsmaciek
2y ago
As a sibling comment guessed, btree indexes in Postgres can store ordered data much more efficiently than random data. Inserting randomly ordered data leads to fragmentation, with lots of empty space on your index pages.
[–]
sparsely
2y ago
The main data is the same, it's the primary key which is smaller, presumably a result of the structure of the uuid7 being more regular.