Hacker News new | ask | show | jobs
by Udo 5412 days ago
I can say from a web dev's perspective that the ubiquitousness of MySQL is only part of the allure (an important part though). MySQL makes simple stuff very easy to implement, it's a great solution if you just want your database to store your stuff and get out of the way. Sure, like any other DB it requires some expertise if you want performance, but it makes this incredibly simple. It just works and you don't spend a lot of time arguing with the software.

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".

2 comments

> 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.

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?
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.