As you may be aware, PostgreSQL splits data files into 8kB pages
by default. It's possible to use different page sizes (up to 32kB),
but that requires compiling custom packages so almost no one does
that. It's quite rare to come across an installation using
different page size at a customer, for example.
Why 8kB data pages and not a different size? Clearly, smaller or
larger pages might be more efficient in some cases, and indeed some
other databases use different page sizes. For example InnoDB uses
16KB pages by default, and some databases even allow a mix of page
sizes. So there seems to be a gain in using different page sizes,
otherwise engineers working on those products would not waste time
So what factors determine the optimal page size? And how do SSD
disks change the results?
One of the fundamental rules about page size, called Five Minute
Rule, was formulated by Jim Gray and G. F. Putzolu in 1985, and
approaches the problem as an economic question "Given disk and RAM
prices, how long should a page of given size be kept in memory?"
The equation expressing the rule is essentially this
break_even_interval = (pages_per_MB * price_per_MB_RAM) * (IOPS_per_disk * price_per_disk)
and for values common in 1985 (1kB pages and disk/RAM prices in
1985), the break even interval came out as roughly 5 minutes (hence
the name of the rule).
However since 1985 a lot has changed - the prices of RAM and
disks plummeted, performance of rotational storage slightly
improved and so on. Despite that, the 1997
revision of the paper came to about the same conclusion - the
break even interval is still about 5 minutes, however assuming 8kB
page size (not 1kB as used in the 1985 paper).
This is probably also the reason why PostgreSQL uses 8kB pages -
Postgres95 (as it was called at that time) was released shortly
before the paper was published, but it had to follow the same
But again, a lot has changed since 1997 - the RAM/disk prices
continued to plummet and, probably more importantly, flash storage