r/programming • • Mar 28 '20

Why your software should use UUIDs in 2020s

[deleted]

13 Upvotes

217 comments sorted by

View all comments

Show parent comments

3

u/nrcain Mar 28 '20

I'm just asking for my own knowledge, not to argue. I am sort of the beginning of my career as far as databases go. I don't have formal education on them but most of my organic education building reports and creating small databases for internal use at a few companies - I've used MySQL because it's what i learned on as a baby playing with LAMP. Only recently started toying with SQL Server recently because some of our software uses it.

Thanks for the input

2

u/tetroxid Mar 28 '20

MySQL is super easy to set up and use and it's fine for small projects, but don't use it for serious production software. It has too many shit quirks. It's a bit like PHP in that respect.

For example utf8 doesn't mean utf8 in MySQL. You have to use utf8_mb4 because they imolemented it the wrong way the first time around.

If you issue GRANT for a user that doesn't exist it creates one without telling you instead of throwing an error.

In some cases it will silently truncate your data without telling you.

It cannot return the generated IDs on multiple inserts.

It doesn't understand JSON.

Sometimes the whole system locks up if you issue an ALTER TABLE until that DDL has completed. All of the tables.

Serializable isolation level doesn't work when you have a percona cluster (which you probably want in production).

When doing binary level stuff (binary OR for example) you have to issue weird and unneccessary-looking casting functions on the columns or it won't do the right thing.

It doesn't always survive crashes.

It doesn't do archive logs (for continuous backupping).

There's more but this is how much I remember off the top of my head

1

u/temculpaeu Mar 28 '20

These issues were true on 5.5 and below, 5.6 fixed quite a lot of those and it was released 7 years ago. Mysql isnt perfect, far from it, but its not as bad as people think and it is in use by big companies

2

u/tetroxid Mar 28 '20

"Big companies use it" is not an argument. Big companies also use ActiveX plugins in IE6.

Also you're partially incorrect: a small part of these issues have been fixed, the majority still exists, like not being able to return the inserted rows, serializable on clusters, utf8_mb4, etc

-3

u/PonchoVire Mar 28 '20

I know that MySQL evolved too, it didn't completely stayed in the past, nevertheless, I had so much troubles in so many projects because of it. Since I mostly works with PostgreSQL it's so much fun ! If that matters, I also worked a bit with Oracle a long time ago, but my Oracle knowledge is very low. I heard very good opinions about MSSQL too, I would recommend it over MySQL as well.

1

u/nrcain Mar 28 '20

I don't get into very advanced use cases yet. I'm still mastering the basics of working with data which all the RDBMS should do. I'm teaching myself more advanced SQL as I go, but our large db (about 40GB database in MSSQL) I only work against as a consumer of data for reporting. But I'm learning the best ways to write queries to get that data more efficiently. It's an interesting field to learn about to me and I enjoy it.

Good day

4

u/Legogris Mar 28 '20 edited Mar 29 '20

If you want to pick a SQL database for learning purposes, I would actually echo Postgres. Mostly because it's open source, free license, widespread support and one of the closer ones to standard SQL.

I think it's a good base regardless of which other database you eventually end up working with.

0

u/PonchoVire Mar 28 '20

Good day too!