Postgres has two layer's cache, one is managed by PostgreSQL, the other is on OS, see PostgreSQL database buffer cache and OS cache for more detail. They are both good for performance. However, in some cases, you want clear all these caches out, to get cold cache performance measured. Just stopping the database server isn't enough, because the operating system cache can be expected to still have plenty of information cached. 

Here is a complete example of cleaning the data out of meory for this database on Linux:

$pg_ctl stop
sudo su -, or su - # depends on the OS
#echo 3 > /proc/sys/vm/drop_caches
$pg_ctl start -l $PGLOG

The sync here is to try and flush all data to disk before we just blow away the caches.

The drop_caches feature on Linux is not intended for regular production server use, it is more of a debugging feature that's potentially dangerous.

For now, you can re-run the same benchmark for your postgreSQL performance measurement.


Comments powered by CComment