Skip to content

shared_memory_size

shared_memory_size shows the size of the server’s main shared memory area (rounded up to the nearest MB). It is read-only metadata in PG15–18, not a runtime tuning control.
Note

Fact — official short description: “Shows the size of the server’s main shared memory area (rounded up to the nearest MB).”

Identity

Type , Valueinteger
Upstream pg_settings type
Context , Valueinternal
Internal/preset and not user-settable
Unit , ValueMB
Raw unit
Range , Value0 – 2147483647
Raw limits in the last observed version
Enum values , Value—
— for non-enum types
Category , ValuePreset Options
Upstream classification
Latest boot value , Value0
0 B

Lifecycle

Fact Value
First observed PG15
Present in PG15–19 Beta 3
Removed in No
Introduction commit bd1788051b02 — Introduce GUC shared_memory_size
Commit date 2021-09-08
Discussion thread 1

Default history

Measured PG9.0–19 Beta 3 boot defaults
Versions Raw boot_val Unit Human value
PG15–19 Beta 3 0 MB 0 B

How it works

Shows the size of the server’s main shared memory area (rounded up to the nearest MB). It is read-only and cannot be changed with SET or configuration-file edits.

It reports the rounded size of PostgreSQL’s main shared-memory segment after startup sizing.

Interpret it with shared_memory_size_in_huge_pages, huge_pages, huge_pages_status. Applications and operations tooling may read shared_memory_size for capability or environment detection, but cannot SET it; cross-cluster comparisons must account for build, initdb, and current-database differences.

Tuning advice

Tip

Advice. These are workload-specific starting points and must be validated with measurements.

Workload Guidance
OLTP Not tunable. Record shared_memory_size as a deployment/capability fact; if it is unexpected, fix the binary, initdb, or database-creation process rather than trying SET.
OLAP Not tunable. Use shared_memory_size to verify format, build, or resource assumptions on analytical nodes and keep every read/write candidate compatible.
Small nodes Not tunable. Preserve it in inventory and incident reports; do not custom-build or rebuild merely to change it without a demonstrated compatibility need.

Pigsty

Values use the fixed 8-vCPU, 32-GiB, 100-GiB SSD fixture and render the current Pigsty templates for PG19 Beta 3; this does not assert current Pigsty support for that historical or beta release.

Template Effective value Versus upstream boot Source expression
OLTP Unmodified — —
OLAP Unmodified — —
CRIT Unmodified — —
TINY Unmodified — —
Caution

Advice — pending human review. Fact from the current Pigsty template projection: OLTP: PG15–19 Beta 3 unmodified; OLAP: PG15–19 Beta 3 unmodified; CRIT: PG15–19 Beta 3 unmodified; TINY: PG15–19 Beta 3 unmodified. No Pigsty-specific rationale is inferred from an absent override.

Common pitfalls

  • Trying to change read-only shared_memory_size with SET or a configuration file.
  • Assuming every cluster, database, or vendor build reports the same value.
  • Ignoring the value in file-format or feature-compatibility checks.
  • Treating reported metadata as a performance target instead of an environment fact.

shared_memory_size_in_huge_pages · huge_pages · huge_pages_status · num_os_semaphores · max_connections · block_size

References