# shared_memory_type

> shared_memory_type — Selects the shared memory implementation used for the main shared memory region. Observed in PG12–19 Beta 3; its last measured boot default is mmap in PG19 Beta 3, with postmaster context. This is a beta-snapshot fact and can change before PostgreSQL 19 GA.
---

> [!NOTE]
> **Fact — official short description:** “Selects the shared memory implementation used for the main shared memory region.”

## Identity {#identity}

| Field | Value | Meaning |
| --- | --- | --- |
| Type | `enum` | Upstream pg_settings type |
| Context | `postmaster` | Requires a server restart |
| Unit | — | Raw unit |
| Range | — | Raw limits in the last observed version |
| Enum values | `sysv`, `mmap` | — for non-enum types |
| Category | Resource Usage / Memory | Upstream classification |
| Latest boot value | `mmap` | mmap |
{.fields meta="-"}

## Lifecycle {#lifecycle}

| Fact | Value |
| --- | --- |
| First observed | PG12 |
| Present in | PG12–19 Beta 3 |
| Removed in | No |
| Introduction commit | [`f1bebef60ec8`](https://git.postgresql.org/gitweb/?p=postgresql.git;a=commit;h=f1bebef60ec8f557324cd3bfc1671da1318de968) — Add shared_memory_type GUC. |
| Commit date | 2019-02-03 |
| Discussion | [thread 1](https://postgr.es/m/HE1PR0202MB28126DB4E0B6621CC6A1A91286D90%40HE1PR0202MB2812.eurprd02.prod.outlook.com) · [thread 2](https://postgr.es/m/2AE143D2-87D3-4AD1-AC78-CE2258230C05%40FreeBSD.org) |

## Default history {#default-history}

| Versions | Raw `boot_val` | Unit | Human value |
| --- | --- | --- | --- |
| PG12–19 Beta 3 | `mmap` | — | mmap |
{.full-width caption="Measured PG9.0–19 Beta 3 boot defaults"}

## How it works {#mechanism}

shared_memory_type selects the operating-system mechanism for PostgreSQL's main shared-memory region, including shared_buffers and other fixed shared state. It does not set the region's size.

Supported enum values and the first-supported boot default are platform dependent. The Docker/Linux catalog reports mmap; Windows has its own implementation, and sysv can require nondefault kernel limits for large allocations.

On Linux, explicit huge_pages support requires mmap. This parameter is distinct from dynamic_shared_memory_type, which governs temporary dynamic segments used by parallel query and extensions. Its postmaster context fixes the value at server start; changing it requires a restart.

## Tuning advice {#tuning-advice}

> [!TIP]
> **Advice.** These are workload-specific starting points and must be validated with measurements.

| Workload | Guidance |
| --- | --- |
| OLTP | Keep the first supported platform default; on Linux that is normally mmap and is required for PostgreSQL's explicit huge-page support. Use sysv only for a verified compatibility need and provision its kernel limits before restart. |
| OLAP | Large shared_buffers increases the importance of reliable main-region allocation, but workload label does not select the API. Validate startup, huge pages, failover, and service limits on the target operating system rather than benchmarking storage throughput. |
| Small nodes | Keep the platform default. Changing the implementation does not reduce the configured shared-memory size and can add kernel-limit or portability failures. |
{.full-width}

## Pigsty {#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 | — | — |
{.full-width}

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

## Common pitfalls {#common-pitfalls}

- Treating the Linux-Docker mmap boot value as a portable default for every operating system.
- Selecting sysv without raising the System V shared-memory kernel limits needed for the main region.
- Forgetting that explicit huge pages on Linux require shared_memory_type=mmap.
- Expecting the parameter to resize shared_buffers or other shared allocations.

## Related parameters {#related-parameters}

[`dynamic_shared_memory_type`](/parameters/dynamic-shared-memory-type/) · [`shared_buffers`](/parameters/shared-buffers/) · [`huge_pages`](/parameters/huge-pages/) · [`huge_page_size`](/parameters/huge-page-size/) · [`min_dynamic_shared_memory`](/parameters/min-dynamic-shared-memory/)

## References {#references}

- [PostgreSQL 19 Beta 3 — shared_memory_type](https://www.postgresql.org/docs/19/runtime-config-resource.html#GUC-SHARED-MEMORY-TYPE)
- [PostgreSQL 19 release notes](https://www.postgresql.org/docs/19/release-19.html)
- [Machine-readable GUC export](/data/guc.jsonl)
