Skip to main content
Solved

RHEL Postgres Block sizes OS/Database

  • February 14, 2024
  • 2 replies
  • 305 views

Forum|alt.badge.img+6

Good morning!

 

We’re setting up a PG instance with Commvault.  We’re running on RHEL which has a default block size of 4k, but it appears PostGres uses a block size of 8k.  Should we be setting RHEL to use 8k blocks for the database mounts?  If so, can you tell me why?  Our OS folks are curious. I appreciate any guidance you might give.

Thanks - Chris

Best answer by sbhatia

Hello Chris, 

 

PGSQL on RHEL should work just fine as it is with default settings. Most filesystems default to 4k or smaller block sizes, so that's what PG is accustomed to run on.

Additionally, you can also check the same with a PGSQL dba as per the below article:

https://community.progress.com/s/article/18293

If the OS block size is 4K and the database has an 8 KB database block size:

  • The OS will need to perform 2 physical I/O's for every database block read.
  • However there will be a benefit regarding index blocks. With larger index blocks more keys can be stored in a single block, so less block reads need to be performed to find specific keys.
  • Similarly, more records can be stored in a single block when the area is configured with the best records per block for the content. This can have a dramatic performance benefit on system i/o performance.

If the filesystem block size can be changed to 8 KB, there will be a benefit all around (assuming the database block size is also changed to 8 KB).  An 8 KB block size will generally give better performance than 4 KB if the records per block have been correctly configured for the content. There are exceptions, such as if the average record size is very small and there are many of these records when the records per block are set too low.

 

Thanks, 

Shikhil Bhatia

View original
Did this answer your question?

2 replies

sbhatia
Vaulter
Forum|alt.badge.img+6
  • Vaulter
  • 46 replies
  • Answer
  • February 16, 2024

Hello Chris, 

 

PGSQL on RHEL should work just fine as it is with default settings. Most filesystems default to 4k or smaller block sizes, so that's what PG is accustomed to run on.

Additionally, you can also check the same with a PGSQL dba as per the below article:

https://community.progress.com/s/article/18293

If the OS block size is 4K and the database has an 8 KB database block size:

  • The OS will need to perform 2 physical I/O's for every database block read.
  • However there will be a benefit regarding index blocks. With larger index blocks more keys can be stored in a single block, so less block reads need to be performed to find specific keys.
  • Similarly, more records can be stored in a single block when the area is configured with the best records per block for the content. This can have a dramatic performance benefit on system i/o performance.

If the filesystem block size can be changed to 8 KB, there will be a benefit all around (assuming the database block size is also changed to 8 KB).  An 8 KB block size will generally give better performance than 4 KB if the records per block have been correctly configured for the content. There are exceptions, such as if the average record size is very small and there are many of these records when the records per block are set too low.

 

Thanks, 

Shikhil Bhatia


Forum|alt.badge.img+6
  • Author
  • Byte
  • 27 replies
  • February 16, 2024

Awesome Shikhil , thank you very much, this is exactly what I was looking for.  I appreciate it!!!


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings