Writing dirty blocks to disk
There are a couple of ways blocks that are dirty can be written to disk. The easiest one to trigger at will is a checkpoint:
postgres=# checkpoint; CHECKPOINT postgres=# SELECT reldatabase,relfilenode,relblocknumber,isdirty FROM pg_buffercache WHERE relfilenode=16391; reldatabase | relfilenode | relblocknumber | isdirty | -------------+-------------+----------------+---------+ 11880 | 16391 | 0 | f | $ ls -l $PGDATA/base/11880/16391* -rw------- 1 postgres postgres 8192 2010-03-01 21:05 /home/postgres/pgwork/data/base/11880/16391
You can see the block is no longer dirty after the checkpoint, and the last updated time for the file saving its data on disk has moved forward to match this write.
From the perspective of the database, each table is a series of numbered blocks, each 8 K in size, starting at 0 when you create the first row and moving forward from there. As you further extend the size of the table, the upper limit...