Inspection of the buffer cache queries
Note that due to multiple changes between PostgreSQL in Version 8.3, few of these queries will work without modification on earlier versions. You will have to remove all references to usagecount
and in some cases may need to adjust how values are cast between types.
For the following examples, output (which are scripted into the code sample named bufcache.sh
included with the book), shared_buffers
is set to 256 MB, and pgbench
is initialized with a scale of 50 (full coverage of pgbench
, another database contrib
utility, appears in Chapter 8, Database Benchmarking):
$ pgbench -i -s 50 pgbench $ psql -x -c "select pg_size_pretty(pg_database_size('pgbench')) as db_size" -[ RECORD 1 ]--- db_size | 711 MB $ pgbench -S -c 8 -t 25000 pgbench
This makes for a total database size greater than the shared buffer cache can hold, forcing some prioritization of what is and isn't kept in there, via the usagecount
mechanism. After creation...