# How pg_tde keeps data encrypted through PostgreSQL storage

> A practical tour of tde_heap, the Storage Manager path, internal keys, principal keys, and WAL encryption.

---

LLMS index: [llms.txt](/llms.txt)

---

> This is the Percona pg_tde 2.3.0 manual. For the paired build, backup tools and major upgrades, see [PG TDE on Mimus](/docs/tde/).

An editorial reading note by PGSTY, based on the upstream documentation.


Encryption only helps when it follows the real storage path. pg_tde marks the tables that need encryption with `tde_heap`, then uses PostgreSQL's Storage Manager to encrypt pages before they reach disk and decrypt them before they enter the buffer cache.

## The two-key hierarchy {#the-two-key-hierarchy}

Each encrypted data file has an internal key. The principal key protects the internal keys and lives in a key provider. This separation lets pg_tde rotate protection without rewriting every data page immediately.

## Where WAL fits {#where-wal-fits}

WAL encryption is cluster-wide. The WAL pages use internal keys, and those keys are protected by the server principal key. A WAL reader uses key metadata to decide which records need decryption.

## Operator consequence {#operator-consequence}

A table can be readable while its key provider is available and unreadable when the provider or credentials are missing. The [key management guide](/docs/tde/upstream/global-key-provider-configuration/overview/) and [recovery limits](/docs/tde/upstream/index/tde-limitations/) belong in the same runbook as the database configuration.

[PG.CENTER edition](https://github.com/pgsty/doc.pg.center/blob/4410c32dc9186a22859008303f474b72a779f583/content/percona/blog/guide/encryption-architecture.md) · [Upstream source](https://github.com/percona/pg_tde/blob/5dd7a9e4e3599d88546f5de67ff0f4ef3fe51a9a/documentation/docs/architecture/encryption-architecture.md)
