# shared_memory_size_in_huge_pages

> shared_memory_size_in_huge_pages shows the number of huge pages needed for the main shared memory area. It is read-only metadata in PG15–18, not a runtime tuning control.
---

> [!NOTE]
> **Fact — official short description:** “Shows the number of huge pages needed for the main shared memory area.”

## Identity {#identity}

| Field | Value | Meaning |
| --- | --- | --- |
| Type | `integer` | Upstream pg_settings type |
| Context | `internal` | Internal/preset and not user-settable |
| Unit | — | Raw unit |
| Range | `-1` – `2147483647` | Raw limits in the last observed version |
| Enum values | — | — for non-enum types |
| Category | Preset Options | Upstream classification |
| Latest boot value | `-1` | -1 |
{.fields meta="-"}

## Lifecycle {#lifecycle}

| Fact | Value |
| --- | --- |
| First observed | PG15 |
| Present in | PG15–19 Beta 3 |
| Removed in | No |
| Introduction commit | [`43c1c4f65eab`](https://git.postgresql.org/gitweb/?p=postgresql.git;a=commit;h=43c1c4f65eab77bcfc4f535a7e9ac0421e0cf2a5) — Introduce GUC shared_memory_size_in_huge_pages |
| Commit date | 2021-09-21 |
| Discussion | [thread 1](https://postgr.es/m/F2772387-CE0F-46BF-B5F1-CC55516EB885@amazon.com) |

## Default history {#default-history}

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

## How it works {#mechanism}

Shows the number of huge pages needed for the main shared memory area. It is read-only and cannot be changed with SET or configuration-file edits.

It estimates how many huge pages the main shared-memory segment needs and returns -1 when the platform cannot provide the estimate.

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

## Tuning advice {#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_in_huge_pages 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_in_huge_pages 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. |
{.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: 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 {#common-pitfalls}

- Trying to change read-only shared_memory_size_in_huge_pages 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.

## Related parameters {#related-parameters}

[`shared_memory_size`](/parameters/shared-memory-size/) · [`huge_pages`](/parameters/huge-pages/) · [`huge_pages_status`](/parameters/huge-pages-status/) · [`num_os_semaphores`](/parameters/num-os-semaphores/) · [`max_connections`](/parameters/max-connections/) · [`block_size`](/parameters/block-size/)

## References {#references}

- [PostgreSQL 19 Beta 3 — shared_memory_size_in_huge_pages](https://www.postgresql.org/docs/19/runtime-config-preset.html#GUC-SHARED-MEMORY-SIZE-IN-HUGE-PAGES)
- [PostgreSQL 19 release notes](https://www.postgresql.org/docs/19/release-19.html)
- [Machine-readable GUC export](/data/guc.jsonl)
