News for hackers. Stuff that matters.
Re:Listen to your to PostgreSQL database in realtime via Web... by tehlike on Friday April 30, 2021 @08:40PM (#27001629)
Having the primary key generatable at application level has performance benefits especially on inserts. You can write all related entities in one go vs waiting for db to generate the the pk, and passing that to dependent entities.
Re:Listen to your to PostgreSQL database in realtime via Web... by skyde on Thursday May 06, 2021 @01:04AM (#27059339)
Also the problem with clustered indexes in a GUID field are that the GUIDs are random, so when a new record is inserted, a significant portion of the data on disk has to be moved to insert the records into the middle of the table.
Re:Listen to your to PostgreSQL database in realtime via Web... by skyde on Thursday May 06, 2021 @12:41AM (#27059224)
you can have "id" Generatable at application level without using GUID. This is what twitter is doing "snowflake".

It generate tens of thousands of ids per second. Those id fit in 64 bits. And those id are sortable, meaning that if tweets A and B are posted around the same time, they should have ids in close proximity to one another.

See: https://blog.twitter.com/engineering/en_us/a/2010/announcing...