Block_Size on NTFS

Started by Nonamealmost 17 years ago6 messagesgeneral
Jump to latest
#1Noname
postgresqlgeneral.domain.thewild_codata@spamgourmet.com

Hi all !

Reading through the list of settings returned by "SHOW ALL", I noticed
the "block_size" variable, which defaults to 8192.

Running on Windows Server, my data directory is on an NTFS partition.
Running CHKDSK on this partition tells me that there are "4096 bytes in
each allocation unit."

Are these allocation units the same as the "block_size", or does this
only have to do with disk geometry ?
If they are the same, is it important that they match ?

Thanks for your help !

Regards,
--
Arnaud Lesauvage

#2Bruce Momjian
bruce@momjian.us
In reply to: Noname (#1)
Re: Block_Size on NTFS

postgresqlgeneral.domain.thewild_codata@spamgourmet.com wrote:

Hi all !

Reading through the list of settings returned by "SHOW ALL", I noticed
the "block_size" variable, which defaults to 8192.

Running on Windows Server, my data directory is on an NTFS partition.
Running CHKDSK on this partition tells me that there are "4096 bytes in
each allocation unit."

Are these allocation units the same as the "block_size", or does this
only have to do with disk geometry ?
If they are the same, is it important that they match ?

It is not necessary they match. It just means that Postgres extends
files in 8k chunks while your file system extends them in 4k chunks.

--
Bruce Momjian <bruce@momjian.us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ If your life is a hard drive, Christ can be your backup. +

#3Craig Ringer
craig@2ndquadrant.com
In reply to: Bruce Momjian (#2)
Re: Block_Size on NTFS

Bruce Momjian wrote:

postgresqlgeneral.domain.thewild_codata@spamgourmet.com wrote:

Hi all !

Reading through the list of settings returned by "SHOW ALL", I noticed
the "block_size" variable, which defaults to 8192.

Running on Windows Server, my data directory is on an NTFS partition.
Running CHKDSK on this partition tells me that there are "4096 bytes in
each allocation unit."

Are these allocation units the same as the "block_size", or does this
only have to do with disk geometry ?
If they are the same, is it important that they match ?

It is not necessary they match. It just means that Postgres extends
files in 8k chunks while your file system extends them in 4k chunks.

... though it's a really good idea that the Pg block size be a multiple
of the file system block size. Since most file systems use blocks of 4k
or some other 2^x power less than that, Pg's 8k block size is basically
always going to be fine.

New hard disks are moving to 4k physical blocks, so you won't have any
issues on new 4k block disks either.

--
Craig Ringer

#4Noname
postgresqlgeneral.domain.thewild_codata@spamgourmet.com
In reply to: Bruce Momjian (#2)
Re: Block_Size on NTFS

Bruce Momjian - bruce@momjian.us a �crit :

postgresqlgeneral.domain.thewild_codata@spamgourmet.com wrote:

Reading through the list of settings returned by "SHOW ALL", I noticed
the "block_size" variable, which defaults to 8192.

Running on Windows Server, my data directory is on an NTFS partition.
Running CHKDSK on this partition tells me that there are "4096 bytes in
each allocation unit."

Are these allocation units the same as the "block_size", or does this
only have to do with disk geometry ?
If they are the same, is it important that they match ?

It is not necessary they match. It just means that Postgres extends
files in 8k chunks while your file system extends them in 4k chunks.

Thanks for your answer Bruce.
So I guess it is good practice to have postgresql's "block_size" set to
an exact multiplie of the filesystem's block_size, right ?

Regards

--
Arnaud Lesauvage

#5Bruce Momjian
bruce@momjian.us
In reply to: Craig Ringer (#3)
Re: Block_Size on NTFS

Craig Ringer wrote:

Bruce Momjian wrote:

postgresqlgeneral.domain.thewild_codata@spamgourmet.com wrote:

Hi all !

Reading through the list of settings returned by "SHOW ALL", I noticed
the "block_size" variable, which defaults to 8192.

Running on Windows Server, my data directory is on an NTFS partition.
Running CHKDSK on this partition tells me that there are "4096 bytes in
each allocation unit."

Are these allocation units the same as the "block_size", or does this
only have to do with disk geometry ?
If they are the same, is it important that they match ?

It is not necessary they match. It just means that Postgres extends
files in 8k chunks while your file system extends them in 4k chunks.

... though it's a really good idea that the Pg block size be a multiple
of the file system block size. Since most file systems use blocks of 4k
or some other 2^x power less than that, Pg's 8k block size is basically
always going to be fine.

New hard disks are moving to 4k physical blocks, so you won't have any
issues on new 4k block disks either.

Yes, it would be suboptimial if our block size was smaller than the file
system block size.

--
Bruce Momjian <bruce@momjian.us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ If your life is a hard drive, Christ can be your backup. +

#6Noname
postgresqlgeneral.domain.thewild_codata@spamgourmet.com
In reply to: Noname (#4)
Re: Block_Size on NTFS

postgresqlgeneral.domain.thewild_codata@spamgourmet.com wrote:

Bruce Momjian - postgresqlgeneral.domain.thewild_codata@spamgourmet.com a ?crit :

postgresqlgeneral.domain.thewild_codata@spamgourmet.com wrote:

Reading through the list of settings returned by "SHOW ALL", I noticed
the "block_size" variable, which defaults to 8192.

Running on Windows Server, my data directory is on an NTFS partition.
Running CHKDSK on this partition tells me that there are "4096 bytes in
each allocation unit."

Are these allocation units the same as the "block_size", or does this
only have to do with disk geometry ?
If they are the same, is it important that they match ?

It is not necessary they match. It just means that Postgres extends
files in 8k chunks while your file system extends them in 4k chunks.

Thanks for your answer Bruce.
So I guess it is good practice to have postgresql's "block_size" set to
an exact multiplie of the filesystem's block_size, right ?

Yes.

--
Bruce Momjian <postgresqlgeneral.domain.thewild_codata@spamgourmet.com> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ If your life is a hard drive, Christ can be your backup. +