This topic has already been discussed here: Understanding block sizes But I have few more things to add for my use case.
Generally, most database systems
use a default block size
of 8 KB
, though some allow it to be modified. On the other hand, modern operating systems
often use a 4 KB
block size for file systems
. This discrepancy can result in multiple physical I/O
requests to fill a single database page
.
A smaller file system block size benefits random reads
, such as index lookups
, while larger block sizes are advantageous for sequential scans
and heap fetches
. Considering these points, I have a few questions:
- Is there a common practice to align the database block size with the file system block size for OLTP?
- In a
clustered system
(e.g.,SQL Server Availability Groups
orPostgreSQL streaming replication
) with a primary and one or more secondaries, is it acceptable to have different file system block sizes, or is this something that should always be avoided? - For
analytical databases
orcolumnar tables
, is it beneficial to use a larger block size?