PostgreSQL vs MySQL: Choosing Your Database Architecture in 2011
Let’s be honest: for the last five years, the default answer for any web project has been MySQL. It’s the 'M' in LAMP. But things are changing fast in 2011. Oracle’s acquisition of Sun Microsystems has spooked a lot of us in the open-source community, and the release of PostgreSQL 9.0 with built-in binary replication is making the "elephant" look a lot more agile.
I’ve spent the last week migrating a high-traffic e-commerce client from a legacy shared host to a dedicated KVM setup here in Oslo. They were suffering from table locks on MyISAM tables every time a backup ran. It brought their site to a crawl. We moved them to InnoDB on MySQL 5.5, but it got me thinking: is MySQL still the automatic choice?
The Contenders: MySQL 5.5 vs. PostgreSQL 9.0
MySQL 5.5: The Speed Demon Gets ACID
MySQL 5.5 is a massive leap forward. Finally, InnoDB is the default storage engine. This means we get ACID compliance (reliability) and row-level locking out of the box. No more table-locking nightmares.
However, MySQL still prioritizes read speed over strict data integrity in some default configurations. If you are running a high-read application like a news site or a blog, MySQL is blistering fast.
Pro Tip: If you are moving to MySQL 5.5, stop guessing your memory settings. In yourmy.cnf, setinnodb_buffer_pool_sizeto about 70-80% of your available RAM on a dedicated database server. This ensures your active dataset stays in memory, reducing disk I/O.
PostgreSQL 9.0: The Data Fortress
PostgreSQL has always been the "academic" choice—technically superior but harder to scale. PostgreSQL 9.0 changes that. The introduction of Hot Standby and Streaming Replication means we can finally set up readable slave servers easily. You can offload your reporting queries to a slave while the master handles the writes. This was the missing link that kept Postgres out of many web startups.
Postgres is strict. It won't let you insert invalid dates or truncate strings silently like MySQL sometimes does. If data integrity is paramount—say you are handling transactions for a Norwegian fintech startup subject to Datatilsynet regulations—Postgres is your safest bet.
The Hardware Factor: Why I/O Matters More Than Software
You can tune sysctl.conf all day, but if your disk subsystem is slow, your database will crawl. This is where the underlying infrastructure of your VPS provider becomes critical.
Most providers in Europe are still running standard 7.2k or 15k RPM SAS drives. In a RAID array, these are decent, but they struggle with random write operations—exactly what databases do. This is where CoolVDS is breaking the mold. By deploying Enterprise SSD storage (Solid State Drives), we are seeing I/O latency drop from 10ms to under 1ms.
When your database fits entirely on an SSD, the difference between MySQL and Postgres becomes negligible for performance because the disk bottleneck vanishes.
Comparison: Which one fits your stack?
| Feature | MySQL 5.5 (InnoDB) | PostgreSQL 9.0 |
|---|---|---|
| Replication | Asynchronous (mature, easy) | Streaming Replication (New in 9.0!) |
| Data Integrity | Good (ACID with InnoDB) | Excellent (Strict typing) |
| Complex Queries | Struggles with complex JOINs | Handles complex analytics well |
| Licensing | GPL (Oracle owned) | BSD (Community owned) |
Local Context: Hosting in Norway
Latency matters. If your customer base is in Oslo, Bergen, or Trondheim, hosting your database in a US datacenter adds 100ms+ of latency to every query. That kills user experience.
Furthermore, under the Personal Data Act (Personopplysningsloven), keeping Norwegian user data within national borders simplifies your compliance with the Data Inspectorate (Datatilsynet). CoolVDS provides that local presence with low-latency peering directly to NIX (Norwegian Internet Exchange).
The Verdict
- Choose MySQL 5.5 if you are running a standard CMS (WordPress, Joomla, Drupal) or need maximum read throughput for a web app. It’s a proven workhorse.
- Choose PostgreSQL 9.0 if you are building a custom application requiring complex data types, geospatial data (PostGIS is amazing), or if you simply don't trust Oracle.
Regardless of your choice, don't let spinning rust hard drives slow you down. Database performance is 80% RAM and Disk I/O. Deploy a CoolVDS instance with SSD storage today and see what happens when IO wait time hits zero.