This section describes the formulas for estimating FUJITSU Enterprise Postgres memory requirements.
Use the following formula to obtain a rough estimate of memory required for FUJITSU Enterprise Postgres:
fujitsuEnterprisePostgresRequiredMemory = sharedMemoryAmount + localMemoryAmount
Shared memory amount
Refer to "Shared Memory and Semaphores" under "Server Administration" in the PostgreSQL Documentation for information on shared memory. If you enable the Global Meta Cache feature, you must also add the value of pgx_global_metacache. Refer to "Parameters" in the Operation Guide for the setting values.
However, note that if instances have been created using WebAdmin, the parameters below will be configured automatically when the instances are created. Take this into account when calculating the shared memory size.
Parameter name | Set value |
---|---|
shared_buffers | 30 percent of the internal memory of the machine. |
max_connections | 100 |
max_prepared_transactions | 100 |
Local memory amount
localMemoryAmount = processStackArea + memoryUsedInDbSessionsThatUseTempTables + memoryUsedInDbSessionsThatPerformSortAndHashTableOperations + memoryUsedInMaintenanceOperations + baseMemoryUsedInEachProcess + memoryUsedPreparingForDataAccess
processStackArea
= max_stack_depth x (max_connections + autovacuum_max_workers + 9)
This formula evaluates to the maximum value.
Actually it is used according to the growth of the stack.
In the formula above, 9 is the number of processes that perform roles specific to servers.
memoryUsedInDbSessionsThatUseTempTables
= temp_buffers x max_connections
This formula evaluates to the maximum value.
Memory is gradually used as temporary buffers are used, and is released when the session ends.
memoryUsedInDbSessionsThatPerformSortAndHashTableOperations
= work_mem (*1) x max_connections
*1) For hash table operations, multiply work_mem by hash_mem_multiplier.
This formula evaluates to the maximum value.
Memory is gradually used as operations such as sort are performed, and is released when the query ends.
memoryUsedInMaintenanceOperations = maintenance_work_mem x (numOfSessionsPerformingMaintenance + autovacuum_max_workers)
Note that 'maintenance operations' are operations such as VACUUM, CREATE INDEX, and ALTER TABLE ADD FOREIGN KEY.
baseMemoryUsedInEachProcess
= baseMemoryUsedInOneProcess x (max_connections + autovacuum_max_workers + 9)
Use the result of the following formula for memory consumed per process. This formula evaluates to the memory used when server processes are running.
In the formula above, 9 is the number of processes that perform roles specific to servers.
The amount of memory consumed per process is determined by the number of tables, indexes, and all columns of all tables that the process accesses. If your system has about 100 tables, you can estimate it to be 3 MB, but otherwise use the following estimate:
baseMemoryUsedInOneProcess = (1.9KB x All user tables + 2.9KB x All user indexes + 1.0KB x All user columns) x 1.5(*1) If you enable the Global Meta Cache feature, use the following formula: baseMemoryUsedInOneProcess = (All user tables + All user indexes + All user columns) x 1.0KB x 1.5 (*1) + (All user tables x 1.4KB + All user indexes x 2.4KB)
*1) Safety Factor (1.5)
There are variable length information. This value takes that into account.
memoryUsedPreparingForDataAccess = variationAmount x (max_connections + autovacuum_max_workers + 4) where variationAmount = shared_buffers / 8KB x 4 bytes (note that 8KB is the page length, and 4 bytes is the size of page management data)
This formula evaluates to the memory required to access the database cache in the shared memory.
In the formula above, among the processes that perform roles specific to servers, 4 is the number of processes that access the database.