Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

There is a good reason why a GUID/UUID or the like should never be used as a database primary key when records are regularly added.

The short answer is that the records are usually stored in the primary key order (clustered index) and every new record being inserted at a random location in the middle of this order rather than just added at the end causes problems.

See http://stackoverflow.com/questions/583001/improving-performa...

http://sqlskills.com/BLOGS/KIMBERLY/post/GUIDs-as-PRIMARY-KE...



Fair point, but most DBs (including MySQL and Postgres) don't cluster their PKs by default - those posts are both referring to SQL Server which apparently does (and that's seemingly an implementation detail).




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: