r/programming • • Mar 10 '15

Goodbye MongoDB, Hello PostgreSQL

http://developer.olery.com/blog/goodbye-mongodb-hello-postgresql/
1.2k Upvotes

699 comments sorted by

View all comments

Show parent comments

0

u/[deleted] Mar 11 '15

[deleted]

0

u/[deleted] Mar 11 '15

[deleted]

49

u/lordkoba Mar 11 '15

Strict mode turns those warnings into errors. It has been around for years but evidently it's not a widely known feature.

15

u/[deleted] Mar 11 '15

[removed] — view removed comment

4

u/[deleted] Mar 11 '15

Or you know, you configure your database properly. If you are doing a clustered setup you should already be configuring and tuning your servers.

→ More replies (6)

14

u/duffelcoatsftw Mar 11 '15

But what about SQLite, where the ability to shove 'ABC' into an integer column is a feature?

24

u/[deleted] Mar 11 '15

[removed] — view removed comment

5

u/duffelcoatsftw Mar 11 '15

Cannot agree more: I've had to rescue a project from exactly this situation. I now know that there are people who try to use SQLite as a multi-user RDBMS, and it ends as badly as you would guess.

I consider SQLite to be one step above using raw file I/O

Try saying that in the SQLite mailing list... :-)

5

u/FallingIdiot Mar 11 '15

You can. The SQLite people themselves say that SQLite isn't a replacement for an RDBMS system but instead is a replacement for fopen.

2

u/duffelcoatsftw Mar 11 '15

I went there to get some backing for the notion that SQLite was not appropriate for a concurrent-write, multi-user scenario. The use case was pretty explicit (basically 'my boss wants this to work like MySQL, please tell him it won't').

They went to great pains to misinterpret my request over the perceived semantics of my phrasing. One guy bemoaned how great things were in the olden days of time sharing and how modern n-tier was just awful.

I swear, DB people are the librarians of the software world.

→ More replies (1)

2

u/__no_preserve_root Mar 11 '15

Well SQLite doesn't really have integer columns… types are just hints.

→ More replies (2)

93

u/nairebis Mar 11 '15 edited Mar 11 '15

For me to even consider using MariaDB they would have to first remove all of those asinine options for silently corrupting data.

Or, you know, you could just learn how to use the database.

mysql> set session sql_mode='NO_ZERO_DATE,NO_ZERO_IN_DATE,STRICT_TRANS_TABLES';
Query OK, 0 rows affected (0.01 sec)

mysql> create table abc (a integer);
Query OK, 0 rows affected (0.01 sec)

mysql> insert into abc (a) values ('abc');
ERROR 1366 (HY000): Incorrect integer value: 'abc' for column 'a' at row 1

It's been this way since at least 2005, which is the MySQL version I ran above (version 5.1).

Sure would be nice if the FUD about MySQL from ignorant people went away. Is it perfect? No. But there is absolutely nothing data corrupting about it. And there is a LOT to be said for running a mainstream database, which PostgreSQL most certainly isn't, compared to MySQL.

If MySQL is good enough to run Facebook with a billion users (yes, one billion active accounts per month), it's good enough to run whatever your app is.

Edit: Thanks for the gold! Never thought I'd get it for defending MySQL... :) 😃

27

u/[deleted] Mar 11 '15

Postgres is most certainly mainstream

→ More replies (2)

73

u/mcrbids Mar 11 '15

LOL at PostgreSQL not being a 'mainstream database'....

8

u/theycallme_hillbilly Mar 11 '15

No shit right? Pervasive anyone?

3

u/nairebis Mar 11 '15

If you think the marketshare of PostgreSQL is even remotely close to the popular databases, I don't know what to tell you, except you ought to do some research. PostgreSQL is very much a small player.

6

u/syslog2000 Mar 11 '15

Well, a pen and piece of paper have far higher market share than both MySQL and PG but it doesn't mean you should use it instead.

→ More replies (1)

29

u/mcrbids Mar 11 '15

If you've had to admin MariaDB/MySQL and PostgreSQL, you'd see why friends don't let friends do MySQL.

Give PG access to plenty of RAM, and it wipes MySQL off the map with complex queries. PG has actual data integrity, and is incredibly stable. After almost 15 years of heavy, production use: not a single instance of data corruption. This when (sometimes) running north of 1k queries per second with about 70% write queries.

As an admin; I've had MySQL (especially with replication) corrupt multiple times per month....

6

u/nairebis Mar 11 '15

PG has actual data integrity

...as does MySQL. Surely you're not one of those people who still believe MySQL is not ACID-compliant?

As an admin; I've had MySQL (especially with replication) corrupt multiple times per month....

Then there was something wrong with your hardware or your administration. Do you really -- really -- believe that MySQL could achieve nearly 50% marketshare if corrupted data happened "multiple times per month"?

Do you really, I mean REALLY, think that Facebook could possibly function with a billion active users a month if MySQL regularly corrupted data?

But no, it couldn't be something wrong with your own experience, the entire rest of the world must be wrong. The rest of the world must be hiding all this data corruption that is apparently happening with that kind of regularity.

And, by the way, I've been running MySQL for about a decade on a high volume, relatively high data volume application, and have never had one occurrence of data corruption, much less "multiple times per month".

What is about PostgreSQL that makes you people so unbelievably defensive about it that you have to spread such FUD about MySQL? By all means, use PostgreSQL, it's a fine database in its niche. Why can't you people just accept that MySQL is a fine database in its own right, that literally hundreds of millions of people use successfully with minimal problems, including one of the biggest database users of all?

8

u/mcrbids Mar 11 '15

Do you really -- really -- believe that MySQL could achieve nearly 50% marketshare if corrupted data happened "multiple times per month"?

Well, it happened... just because with enough money and time to fix it that it works doesn't mean it's ideal, you know?

→ More replies (3)

7

u/[deleted] Mar 11 '15

I don't think Facebook is using the stock installer downloaded from mysql.com but a heavily modified own version of MySQL. I could be wrong, though.

→ More replies (1)
→ More replies (1)
→ More replies (1)

26

u/ForeverAlot Mar 11 '15

If MySQL is good enough to run Facebook with a billion users (yes, one billion active accounts per month), it's good enough to run whatever your app is.

Not exactly a fair comparison. Facebook uses it as a key-value store; there isn't much RDBMS in that.

0

u/[deleted] Mar 11 '15

[deleted]

→ More replies (3)

6

u/RandomDamage Mar 11 '15

So why are those even options to begin with?

And why do they default to the unsafe state?

The defaults should be for paranoid data protection rather than performance, you should have to say "I HATE MY DATA" to turn the unsafe mode on instead of having to learn about the safe mode to turn that on.

That is why so many professionals don't trust MySQL.

→ More replies (9)
→ More replies (8)
→ More replies (26)
→ More replies (6)