3 ms·
Postgres has had auto-incrementing row ids for a while, see this example: https://gist.github.com/1178237 https://gist.github.com/1178237
by wlll 15y ago
Postgres has had auto-incrementing row ids for a while, see this example: https://gist.github.com/1178237 https://gist.github.com/1178237
- Udo 15y agoI may be wrong, but isn't that just a syntactical shortcut for creating a separate sequence table?
- masklinn 15y agoYes (that's noted in the gist). But the end result's the same, instead of writing AUTOINCREMENT you write SERIAL. That's about it, the only issue may happen if you drop the table (the sequence will not be dropped, not a huge issue in practice)
- Udo 15y agoDid you notice any differences in performance? Edit: I'm not saying there are, but it feels like there might be some repercussions when you take the underlying implementation into account. It would be interesting to know if someone conducted comparative tests about this.