Has anyone been able to find any benchmarks comparing PostgreSQL and MySQL performance when they are used by a system through Hibernate (or another comparable ORM) and the 2nd level cache (backed by Memcache, EhCache, etc) is enabled?

I've seen a lot of benchmarks comparing and MySQL performance (most of which are outdated but that's besides the point) but none of them ever seem to factor in a 2nd level cache. That makes the benchmark entirely irrelevant to me because any highly scalable system that relies on a relational database is going to need a 2nd level cache.

PS Let me know if this is not the site to ask this question and it belongs on one of the many other StackExchange sites instead. Please migrate the question as usual if that's the case, thanks.

  • 2
    Why would the second level cache be of any relevance to the "raw" database performance? It just takes load off the database which is probably the same as running the benchmark with less queries per second. May 4 '12 at 6:36
  • But this begs the question implicit in what I'm asking-- does a 2nd level cache affect performance equally for a system backed by MySQL/Postgres? The 2nd level cache only affects certain types of queries, for example queries which you search by ID (eg select * from table where id in (2,3)). Let's suppose hypothetically that MySQL was fast as those queries and Postgres was not. If you then enable the 2nd level cache, then whatever tradeoff Postgres might've made that resulted in slower id-in query would be very much worth it for a 2nd-level cache enabled system.
    – artif
    May 6 '12 at 6:21

Left unconfigured, PostgreSQL will outperform MySQL. In fact, left unconfigured, InnoDB in some older versions of MySQL are better than newer versions of MySQL.

Tuning PostgreSQL and MySQL and then Benchmarking for occassional usage in the presence of memcached is a lot like building two cars, drag racing them, and then parking them forever. That only leaves the open road and whatever happens to be in the middle of highway.

If you have a large working set and high turn around of data, then perhaps memcached and other second-tier caches woiuld be unnecessary. From that point forward, choice of database and benchmarking would be worthwhile and intriguing.

  • 1
    Left unconfigured, PostgreSQL is slow as well. Using default configurations tells you nothing when running a benchmark. May 5 '12 at 6:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.