I followed the steps as outlined in this tutorial to use pg_prewarm
extention for pre-warming the buffer cache in PostgreSQL:
The first time I ran it, I got 1
as the result:
mydb=> SELECT pg_prewarm('useraccount');
pg_prewarm
------------
1
After that I had to drop the table and recreate it. Since then, when I run the same command, I get 0
as the result always. I am not sure if that's expected or if I am missing something?
mydb=> SELECT pg_prewarm('useraccount');
pg_prewarm
------------
0
The function comment in contrib/pg_prewarm/pg_prewarm.c
says:
* [...] The
* return value is the number of blocks successfully prewarmed.
So the first time, there was 1 block in the table. After dropping and re-creating the table, it is empty, so 0 blocks are cached.