I want to change mu pgsql database config and I wonder what units they use there to describe some values. Mostly I want to know about shared_buffers.
If my shared_buffers value is for example 16384, is it KB? MB? Bytes? What is the unit of this value?
shared_buffers (integer) Sets the amount of memory the database server uses for shared memory buffers. The default is typically 32 megabytes (32MB), but might be less if your kernel settings will not support it (as determined during initdb). This setting must be at least 128 kilobytes.
The default is 4 gigabytes ( 4GB ).
PostgreSQL maintains data in fixed-sized storage units called pages. The size of a page is defined during the PostgreSQL server compilation process. The default page size is 8k, but this can be changed to a higher value.
When you execute
SHOW shared_buffers;
I get something like
shared_buffers
----------------
256MB
(1 row)
This tells the the current value.
shared_buffers
is counted in disk blocks. The default block_size
setting is 8kB, and can't be changed without recompiling the server, so that's almost certainly what you're using. This would mean that shared_buffers=16384
equates to 128MB.
SELECT * FROM pg_settings
will show you the base units for a setting, among other things. As @DrColossos pointed out, SHOW shared_buffers
will give you a qualified amount, and like @Raptor said, you can (and should!) specify units for any setting which has them.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With