It's great to see Postgres growing, but I often wonder why it isn't growing faster, especially when compared to MySQL. Without getting into a religious flame war, I'm curious what the HN thinks about that?
It's great to see Postgres growing, but I often wonder why it isn't growing faster, especially when compared to MySQL. Without getting into a religious flame war, I'm curious what the HN thinks about that?
People don't need those white-label commodity cPanel or Plesk shared-hosting or VPS services to run SaaS applications anymore - it's far better for everyone[1] when they switch to a major cloud provider, namely AWS, Azure, GCP, etc.
I argue that most web/saas devs today grew up with - and tinkered-with - said white-label services: which means they got their experience with MySQL because it was part of the stock default configuration for all those web-host accounts: with PHP, maybe Perl, and many preinstalled web-applications like phpBB, Wordpress, Coppermine, phpNuke, and so on... and that's probably a solid 15+ years of commonplace web-hosting market saturation (thinking 2001 through 2016, with 2014 being the tipping-point for AWS/Az/GC being the home of SaaS).
You'd be in high-school age-range (14-18?) and get bored of simply running other peoples' programs on your web-space, and you saw these web-applications were written in PHP so you'd follow some series of online tutorials for PHP and when it inevitably leads to databases they assume you have MySQL - and MySQL (at the time) had not only the widest installbase, but also had a far more forgiving SQL engine than anyone else. While PostgreSQL was often only a few clicks away via quick installers built-in to cPanel/Plesk/etc, MySQL was a safer-bet by everyone involved.
...but those days are past: as a personal anecdote: at no-point in the past 10 years have I come across any "serious" PHP web-application software intended for private or on-prem usage since vBulletin or SVN.
[1]Except free-as-in-freedom software advocates...
If only postgres won the marketing battle back then...
Be glad they didn't - otherwise their support dept. would be buried under questions from web-hosting newbs.
Why?
There's Phabricator [0], which incidentally uses MySQL.
I feel the same way with Unix/Linux. At one point I was told that my organization may be migrating away from Linux, and redeploy everything under Windows. The management layer really couldn't understand that they would lose nearly every Linux admin on staff (that happened to also have deep understanding of their apps and infrastructure). "Why would someone have a problem with switching platforms -- we'll provide you the training" was their answer. Fortunately we were able to come up with a number of technical (and cost related) issues that the project was shot down.
Companies with large and complex db installations often need the complexity for various reasons that are difficult to escape, even if you're working on a green field project.
Of course if you don't need any of these additional tools or can't afford them, then yeah pg is a great choice.
Aside from the raw cost, the licensing model and cost considerations can drive design decisions. In my experience, most shops that use MSSQL do so because nobody on staff has experience with other databases.
If you're a small 2-5 person team, sure. But once dev payroll breaks $1M/yr, paying ~$100k for SQL Server doesn't seem so bad anymore.
I have yet to encounter a team that would rather have SQL Server than another developer given the explicit choice between the two (assuming easy migration, etc.).
I've only interacted with Analysis Services and Reporting Services for maybe five minutes, but the impression I was left with is that they're extremely clunky, even by Windows standards. I also remember a weird situation with SSL wildcard certificate configuration, where the interface said the configuration wasn't applied, but it actually was.
My client subcontracts this to a supposedly "expert DBA" shop, and they always seem to take ages to do what look like simple things on the surface. (I rarely if ever interact with them, so I don't know whether they're actually competent or not.)
They probably do if you have certain needs, but at lots of places they seem to be the basis for solutions that would be far less complicated (and maintainable with a far more common skillset) without them.
Tools like Airflow and Druid are just now getting to where those tools were in 2005 ... unfortunately those tools haven't done much since about 2015 when Azure became the new hotness.
IME, that “deep experience” often means “a very expensive support contract and internal technical staff who walk through decade+ out of date cargo cult rituals by rote without understanding the rationale and why it has been gone longer than they've been employed”.
1. MySQL has a simpler permission model, so user management is less of a headache.
2. Connections are cheaper in MySQL so you don't have to use an external connection pooler like pgbouncer.
3. There's more/better documentation on MySQL performance tuning, especially from Percona.
That's really it for me.
Postgresql is following a blacklist access model which is really hard to get right, a whitelist approach like mysql would be much easier.
I don't think this is quite right. When a new user is created in Postgres, I don't believe any permissions are implicitly GRANTed by default aside from CONNECT. And I believe the only default privileges granted on a given database are to its owner. Is it possible your experience has only been with configurations in which your PG user was either the owner of the database or a superuser?
EDIT: clarification
[1] https://aws.amazon.com/de/blogs/database/managing-postgresql...
In particular, note the justification for the default:
> Keep the default. All users access the public schema implicitly. This simulates the situation where schemas are not available at all, giving a smooth transition from the non-schema-aware world. However, this is never a secure pattern. It is acceptable only when the database has a single user or a few mutually-trusting users.
Note that you can change the set of default privileges, including the grant to PUBLIC. E.g. ALTER DEFAULT PRIVILEGES REVOKE ALL ON TABLES FROM PUBLIC;
> The only way to remove this is to remove the rights on the public role affecting every other user. In this case the mysql concept is better as every new user has by default absolutely no rights.
This seems a bit contradictory...
Or you just use the text protocol and escape your parameters in the app...
I personally LOVE pg over all other choices, but I've got some 5-year-old apps sitting on a little mysql DB and no intention to move them. Dbs are small, performance is good enough, cost of instances wouldn't be very different on PG, but cost of moving everything over is probably a week or two of work that would be pretty hard to justify given the current situation.
2. Companies looking for enterprise support don't see anyone as high profile as Microsoft, Oracle, and err, Oracle supporting Postgres.
(Whether ongoing interaction with Oracle is a net positive is of course debatable. At a previous company our only interaction with Oracle was them being inflexible and expensive that ultimate meant we had a Oracle DB on prem serving a AWS hosted service because it would have cost too much to put it in AWS. Note, this was many years ago, before AWS had a compatible offering, and apparently Oracle even have loosened up a bit here since.
We see some customers building new solutions on Postgresql, but for large setups, it’s still MariaDB/Galera or Oracle and there isn’t a big push to drop Oracle.
Lots of things are just half-baked and very clumsy in Postgres compared to MySQL (MariaDB).
When PostgreSQL would get a built-in replication tool would increase it's popularity a lot, but I guess the core team wants to focus on the DB, and management tools are left to the others to develop.
IMO replication is a core feature of a DBMS (like transactions or SQL support), the fact that you need to install obscure third-party tools to bring Postgres into the modern age is bonkers.
We're having scalability problems with our RDBMS, but it's something RDBMSs in general don't solve.
This not the only problem, but it is the most pernicious
Outside the context of db comparisons, and in relation to the specific case, if you don't have triggers/foreign keys on a given MySQL table, Gh-ost¹ solves the DDL locking issues.
Has been since MySQL 5.6 (released Feb `13).
¹=https://mysqlserverteam.com/mysql-8-0-innodb-now-supports-in...
²=https://dev.mysql.com/doc/refman/5.6/en/innodb-online-ddl-op...
For instance, suppose you have a query that requires a full table scan. In PostgreSQL, that query comes in and the DB starts the scan. Now, a second such query comes in. PostgreSQL notes “I’m on row 10,000” and continues running one single scan, sending results to both queries. When it reaches the end of the table, it marks the first query as complete, then goes back to the beginning of the table and starts scanning again, sending results to the second query up until it reaches row 10,000. Now the second query has seen every row in the table and it’s finished.
Now imagine 100 such queries arrive. Rather than doing 100 full table scans, PostgreSQL satisfies all of them concurrently, taking at most 2 full scans (assuming the 100th queries joins in on the very last row of the first scan).
PostgreSQL has a million such optimizations under its hood that make it happily chug away even when it’s getting slammed. You can vertically scale a single-instance PostgreSQL server a lot higher than many people would believe.
So does MySQL. Facebook, Google, and Percona have contributed many upstream patches to harden and improve MySQL over the years. MySQL also has much better observability to find issues causing problems, from index_statistics to hunting down individual queries causing locks.
I agree that Postgres is by far the better engineered product, but it's not necessarily the better RDBMS product because of that. MySQL is battle tested in a way that Postgres isn't (yet).
InnoDB had ranged from slightly faster to much slower than Postgres depending on exactly what you’re doing. Once you’re doing more than trivial queries the MySQL optimizer tends to fall apart, often in weird ways with arbitrary thresholds where performance goes from decent to terrible after a table grows by 5%.
Also, when I brought up postgres for a new project & mentioned it being open source, response was "that means it could vanish any day"
Inertia is real
This is a very good and fair question. Postgres is growing a lot, but is it growing enough, according to its true potential? It has everything: incredibly robust and trusted; very large feature set; not under any company's direction; extremely liberal license. Should be conquering the database market, and by far is not!
I don't have an answer. I have potentially, many. Possibly I will blog about this at some time. But I believe that definitely it should be growing more and becoming more relevant than it is right now.
This is no detriment at all to all the fantastic work done by everybody; but just the ambition that Postgres can and should go farther.
CREATE PROCEDURE get_customer_and_orders
@id int
BEGIN
SELECT id, first_name, last_name, email, etc FROM customers WHERE id = @id;
SELECT id, store_id, created_at, etc FROM customer_orders WHERE customer_id = @id;
END
I've quickly built entire applications with this tactic as the centerpiece. You can argue that it moves business logic into the database layer and to that I'd say "good", at least for apps that are maintained by IT departments with many strong SQL people and not so many developers. If you know TSQL, you know that you can also do branching, looping and other logic operations within this same procedure - you can even decide to send back 3 resultsets instead of 2 if you want to and the client API allows you to handle whatever it received quite elegantly.I think that features like this are why many businesses will stay on SQL Server. Also the high quality of tools for SQL Server that have no match in Postgres such as SQL Server Management Studio, SQL Server Data Tools, SQL Server Profiler, SQL Server Integration Services among many other such tools that are extremely well integrated.
That being said, haven’t some recent versions of Postgres added support for stored procedures or some variant? I’m curious if we’d seen any changes in performance if we experimented with switching over.
It's absolutely ridiculous to make a blanket statement about this very useful feature.
I've done the benchmarking on many applications of this tactic. It very often works better with multiple select statements. I'll certainly trust hard performance numbers against an ill conceived opinion any day.
Also the freetds guys hate it :) https://www.freetds.org/mars.html
(I am currently converting a MARS app explicitly so it never does utilizes this approach)
It is almost guaranteed that if a client is running on MySQL, you can be certain their entire code base is going to be plagued with less-than-best-practices. Not to be too harsh, but MySQL's most prominent use case is for projects that start with "let's just stand-up a DB real quick and we'll sort out the hard stuff later".
DBAs and Engineers that know MySQL will always use MySQL. In corps MySQL is a safe choice (sadly).
Also, database/schema/tables is great when doing things like multi-tenancy where you split customers by schema (which also makes horizontal scaling super easy if needed).
For example, when you type quit instead of quitting it instead prints out that you must type a different command to quit
All of \q, quit, and exit work fine starting psql 11?
If I'd compare this to MySQL, where you must move tables one-by-one to another schema (nay database) with the new name to 'rename' your database [0], then I'm very happy with postgres' hierarchy structure.
[0] That is, if you're even allowed to, because if you have a trigger on your table, good luck renaming your database. See https://dev.mysql.com/doc/refman/8.0/en/rename-table.html
Real work gets done with PostgreSQL. You can't buy something from Amazon.com without using PostgreSQL. The more Amazon talks about that in their ecosystem, the more PostgreSQL becomes the default choice for all new developers within that (very large) ecosystem.
When you combine that with the loud presence of another 800lb Gorilla promoting PostgreSQL (MSFT), the market has spoken.