Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Postgresql vs. MySQL: how do their data sizes compare to each other?

For the same data set, with mostly text data, how do the data (table + index) size of Postgresql compared to that of MySQL?

  • Postgresql uses MVCC, that would suggest its data size would be bigger

  • In this presentation, the largest blog site in Japan talked about their migration from Postgresql to MySQL. One of their reasons for moving away from Postgresql was that data size in Postgresql was too large (p. 41): Migrating from PostgreSQL to MySQL at Cocolog, Japan's Largest Blog Community

  • Postgresql has data compression, so that should make the data size smaller. But MySQL Plugin also has compression.

Does anyone have any actual experience about how the data sizes of Postgresql & MySQL compare to each other?

like image 765
Continuation Avatar asked Aug 16 '10 01:08

Continuation


People also ask

How does PostgreSQL differ from MySQL?

The Critical Differences of Postgres vs MySQL: MySQL is a simpler database that's fast, reliable, well understood, and easy to set up and manage. PostgreSQL is an object-relational database (ORDBMS) with features like table inheritance and function overloading, whereas MySQL is a pure relational database (RDBMS).

Is Postgres more scalable than MySQL?

Postgres does tends to scale better especially when you have reads, writes, and long complicated queries at the same time.

What is the size of PostgreSQL database?

PostgreSQL has a limit of 1GB for the size of any one field in a table. In practice, the limit comes from the amount of memory available for the server to manipulate the data and transfer it to the client.

What makes PostgreSQL better than MySQL?

MySQL is a purely relational database, whereas PostgreSQL is an object-relational database. PostgreSQL offers more sophisticated data types, and lets objects inherit properties. On the flip side, it also makes it more complex to work with PostgreSQL. PostgreSQL houses a single, ACID-compliant storage engine.


1 Answers

  • MySQL uses MVCC as well, just check innoDB. But, in PostgreSQL you can change the FILLFACTOR to make space for future updates. With this, you can create a database that has space for current data but also for some future updates and deletes. When autovacuum and HOT do their things right, the size of your database can be stable.
  • The blog is about old versions, a lot of things have changed and PostgreSQL does a much better job in compression as it did in the old days.
  • Compression depends on the datatype, configuration and speed as well. You have to test to see how it's working for you situation.

I did a couple of conversions from MySQL to PostgreSQL and in all these cases, PostgreSQL was about 10% smaller (MySQL 5.0 => PostgreSQL 8.3 and 8.4). This 10% was used to change the fillfactor on the most updated tables, these were set to a fillfactor 60 to 70. Speed was much better (no more problems with over 20 concurrent users) and data size was stable as well, no MVCC going out of control or vacuum to far behind.

MySQL and PostgreSQL are two different beasts, PostgreSQL is all about reliability where MySQL is populair.

like image 61
Frank Heikens Avatar answered Sep 22 '22 14:09

Frank Heikens