This has results for modern Postgres and MySQL using write-heavy tests from sysbench and a large server. I think there are regressions in Postgres that arrive in some of versions 16, 17, 18 and 19 beta1 but I am far from certain and this blog post is just another step in my journey to figure that out.
tl;dr
- Postgres suffers a lot from throughput variation while MySQL+InnoDB does not
- InnoDB gets much better average throughput on 6 of 10 tests, similar throughput one one and then Postgres does better on 3 of 10 tests
- For tests from which I provided vmstat and iostat results, Postgres does more write IO per operation. In some cases InnoDB uses more CPU, in other cases it does not.
- Postgres from source for versions 15.17, 16.13, 17.9 and 18.3.
- MySQL from source for version 8.4.7
- an ax162s with an AMD EPYC 9454P 48-Core Processor with SMT disabled
- 2 Intel D7-P5520 NVMe storage devices with RAID 1 (3.8T each) using ext4
- 128G RAM
- Ubuntu 24.04
- the config file is named conf.diff.cx10a_c32r128 (x10a_c32r128) and is here for versions 15, 16 and 17.
- for Postgres 18 I used conf.diff.cx10b_c32r128 (x10b_c32r128) which is as close as possible to the Postgres 17 config and uses io_method=sync
- I only run the write-heavy tests (to save time)
- The tables are larger than memory and cannot be cached
- Each test (microbenchmark) is run for 2 hours when I normally run each for 15 minutes
- After each test a vacuum is done
(QPS for some version) / (QPS for Postgres 15.17)
Summary:
- throughput for Postgres drops after version 15.17. I don't know yet whether this is a regression.
- throughput for InnoDB is much better than Postgres in 6 of 10 tests, similar in one test, and much worse in 3 of 10 tests.
- Postgres suffers from too much variance
- Average throughput is ~1.55X larger for InnoDB than for Postgres
- Per operation, Postgres does ~1.20X more write IO (KB written) to storage than InnoDB
- Per operation, InnoDB uses more CPU and does more context switches. While autovacuum was enabled and was likely running during the test, my measurements exclude the manual vacuum done at the end of each test.
- Postgres suffers from too much variance
- Average throughput is ~1.09X larger for InnoDB than for Postgres
- Per operation, Postgres does ~1.30X more write IO (KB written) to storage than InnoDB
- Per operation, InnoDB uses more CPU and does more context switches. While autovacuum was enabled and was likely running during the test, my measurements exclude the manual vacuum done at the end of each test.
- Postgres suffers from too much variance
- Average throughput is ~2.06X larger for Postgres than for InnoDB
- Per operation, Postgres does ~1.67X more write IO (KB written) to storage than InnoDB
- Per operation, Postgres uses more CPU and does more context switches. This is the opposite of what happens above for update-index and update-zipf.


