Quantcast
Channel: Planet PostgreSQL
Viewing all articles
Browse latest Browse all 9642

Amit Langote: How much of your pgbench test data is in the OS disk cache using linux-fincore

$
0
0

Following little script which utilizes linux-fincore hosted here gives you the OS disk cache resident pages of the tables in your pgbench database, the one used in a typical pgbench test.

echo “tablename | size | total_pages | min_cached page | cached_pages | cached_size | cached_perc”

psql -d pgbench -tc \
“SEELCT ‘$PGDATA/base/’ || d.oid::text || ‘/’ || c.relfilenode::text, c.relname\
FROM pg_class c, pg_database d\
WHERE c.relname LIKE ‘pgbench_%’ AND d.datname=’pgbench’” | \

tr -d ” ” | \
sed ‘s/|/\t/g’ |\
grep -v “^$” | \

while read path file; \
do \
echo -n $file;
linux-fincore -so $path | \
grep -v “filename\|—” |\
awk \
‘{print “\t”, $2,”\t”,$3,”\t”,$4,”\t”,$5,”\t”,$6,”\t”,$7}’ | \
tr -d “,”; \
done



Viewing all articles
Browse latest Browse all 9642

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>