Creating a new block in a database

Once you insert something into this table, a page is allocated in the buffer cache to hold that new information, and a standard 8 KB block is allocated on disk. Now we make an insert on the table t and check if the block is dirty:

pgbench=# INSERT into t(i) values (0);INSERT 0 1bash-4.2$ ls -l $PGDATA/base/16384/16399-rw-------. 1 postgres postgres 8192 24 feb 16.48 base/16384/16399pgbench=# SELECT reldatabase,relfilenode,relblocknumber,isdirty,usagecountFROM pg_buffercache WHERE relfilenode=16399;reldatabase | relfilenode | relblocknumber | isdirty | usagecount-------------+-------------+----------------+---------+------------16384 |16399 |0 | t|1

Now make another insert and then check again if the block ...

Get PostgreSQL 10 High Performance now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.