Top
Enterprise Postgres 17 Installation and Setup Guide for Server

F.1 Fujitsu Enterprise Postgres Memory Requirements

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

sharedMemoryAmount = 1523444
                         + 8518 x x
                         + 7154 x (a + b + c + d + 1)
                         + 405 x (a + b + c + d + e) x f
                         + (1208 + g) x (a + b + c + d + 9)
                         + 64 x b
                         + 568 x c
                         + 104 x d
                         + 5666 x e
                         + 112 x h
                         + 8200 x i
                         + 512 x j
                         + 4 x (k + 10)
                         + 1097984 x m
                         + 258 x (a + b + c + d + 1 + e) x o
                         + (1024 x 1024) x p
                         + n
                         + 128 x q

The above units are Byte.

Parameter Details:
x = shared_buffer/8 
    Note : Units of shared_buffer (kB)
    Example : x = 16384 (128 x 1024/8) when shared_buffer = 128 MB
        Convert MB to KB to calculate x.
a = max_connections
b = autovacuum_max_workers
c = max_worker_processes
d = max_wal_senders
e = max_prepared_transactions
f = max_locks_per_transaction
g = track_activity_query_size (byte)
h = max_logical_replication_workers
i = wal_buffers/8
  Note: If wal_buffers is the default value (-1), calculate i = x/32.
         However, if it becomes 2048 or more, set the maximum value to 2048.
         If i = x/32, there is a limit on the maximum value of i.
         Max i = WAL segment size/8
         The WAL segment size can be set with the initdb option --wal-segsize.
         The WAL segment size is in kilobytes.
         (The default WAL segment size is 16 MB. Convert to KB when calculating i)
  Example: If shared_buffer = 128 MB and wal_buffers = -1, i = 512 (16384/32)
             If shared_buffer = 2 GB and wal_buffers = -1, i = 2048 (2 x 1024 x 1024/8/32 = 8192,
             but the maximum value of i is 2048)
             If wal_buffers = 512 kB, i = 64 (512/8)
             i = 4096 (32 x 1024/8) when wal_buffers = 32 MB
                   Converts MB to KB to calculate i.
j = max_replication_slots
k = old_snapshot_threshold
  Note: If old_snapshot_threshold is the default value (-1), there is no need to add "4 x (k + 10)" to the quote formula.
           old_snapshot_threshold units (min)
  Example: k = 60 (1 x 60) if old_snapshot_threshold = 1 h
               Convert h to min to get k.
m = pgx_global_metacache (megabytes)
n = memory size requested by the plug-in (determined by the plug-in)
o = max_pred_locks_per_transaction
p = min_dynamic_shared_memory (MB) 
q = number of database roles

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

Process stack area
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.

Memory used in database sessions that use temporary tables
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.

Memory used in database sessions that perform sort and hash table operations
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.

Memory used in maintenance operations
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.

Base memory used in each process
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.

Memory used preparing for data access
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.