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

> I can create them all with one round trip rather than multiple.

I see. I'd lean towards using common table expressions. The first insert statement returns the primary key and other inserts can depend on the key. I do understand it's not a panacea and composing queries can be problematic.

> a sequence generator for PKs, it becomes a resource around which there is contention

As I understand, Postgres sequences don't block which leads to a different problem [1].

[1]: https://news.ycombinator.com/item?id=27843084



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

Search: