TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

UUIDs are so much better than autoincrementing ids and it's not even close

4 pointsby ardmeabout 2 years ago

1 comment

idiocratabout 2 years ago
(For MS SQL server)<p>If UUIDs are not sequential (i.e. random), there could be performance problems to used those as PK with an underlying clustered index (CI).<p>The CIs work best with sequential values.<p>Inserting a random value into a CI will certainly cause: (1) touching of many pages (write amplification), (2) index fragmentation, (3) page splits, (4) pages being half-full.<p>Furthermore, if you have other indexes defined on the table, these problems apply to these indexes also.<p>This of cause depends on data quality and data volume.<p>For the &quot;mostly-append&quot; fact tables, I would advise against using UUIDs as PKs with CI.
评论 #34977928 未加载