Re:Can PostgreSQL pickup where MySQL left off?
by masklinn on Monday August 29, 2011 @07:57AM
(#2936842)
> It also has a single feature that I find incredibly cool: it supports automatically generated row IDs. It's been a while since I last tried Oracle and Postgres, but at the time you had to create a second table just for a sequence number and it was extremely awkward to handle.
Must have been a while indeed. Postgres's SERIAL datatype has been available at least since 6.4. Postgres 6.4 was released in 1998.
Re:Can PostgreSQL pickup where MySQL left off?
by wlll on Monday August 29, 2011 @07:44AM
(#2936800)
Postgres has had auto-incrementing row ids for a while, see this example: https://gist.github.com/1178237
I may be wrong, but isn't that just a syntactical shortcut for creating a separate sequence table?
Re:Can PostgreSQL pickup where MySQL left off?
by masklinn on Monday August 29, 2011 @07:58AM
(#2936844)
Yes (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)
Did 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.
It also has a single feature that I find incredibly cool: it supports automatically generated row IDs. It's been a while since I last tried Oracle and Postgres, but at the time you had to create a second table just for a sequence number and it was extremely awkward to handle.
Could the auto-increment feature in MySQL be better? Sure, for example it would be nice to have an option where the row is identified by a hash value instead of a continuous sequence. But even in its limited form today it beats having to wrestle with the glued-together equivalent as implemented in "real databases".