Type: | integer |
Default: | 1024 (8MB) |
Min: | 16 (128kB) |
Max: | 1073741823 (8589934584kB) |
Unit: | 8kB |
Context: | postmaster |
Restart: | true |
Sets the amount of memory the database server uses for shared memory buffers. The default is typically 128 megabytes (128MB
), but might be less if your kernel settings will not support it (as determined during initdb). This setting must be at least 128 kilobytes. However, settings significantly higher than the minimum are usually needed for good performance. If this value is specified without units, it is taken as blocks, that is BLCKSZ
bytes, typically 8kB. (Non-default values of BLCKSZ
change the minimum value.) This parameter can only be set at server start.
If you have a dedicated database server with 1GB or more of RAM, a reasonable starting value for shared_buffers
is 25% of the memory in your system. There are some workloads where even larger settings for shared_buffers
are effective, but because PostgreSQL also relies on the operating system cache, it is unlikely that an allocation of more than 40% of RAM to shared_buffers
will work better than a smaller amount. Larger settings for shared_buffers
usually require a corresponding increase in max_wal_size, in order to spread out the process of writing large quantities of new or changed data over a longer period of time.
On systems with less than 1GB of RAM, a smaller percentage of RAM is appropriate, so as to leave adequate space for the operating system.