K/V Benchmark: PostgreSQL vs. Redis vs. Memcached
cybertec-postgresql.com
cybertec-postgresql.com
EDIT: Additionally the version of memcached used in the benchmarks was from July of 2012 -- even older!
> the results were pretty horrifying indeed and one should rather not use Python for benchmarking databases – a lot of CPU time just disappeared somewhere!
Postgres reads might be so fast because the test script reads keys in the order they were written. Postgres benefits from cache locality, as the table file maintains that order.
Afaik redis will check TTLs on access as well as in a background process, so postgres isn't really behind on this one.
In my experience, your cache entries are usually gonna be a ton of pre-serialized bytes or some json blobs -- which could be on the order of kbs or mbs. That'll be where redis/memcached start to really shine.