# Architecture overview

> Follow encrypted tables, index files, and WAL through the pg_tde storage architecture.

---

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/).

`pg_tde` is a **customizable, complete, data at rest encryption extension**. Extension means that `pg_tde` is delivered as a PostgreSQL extension.

> [!NOTE]
> `pg_tde` relies on extensibility changes in the PostgreSQL core. It currently runs only with [Percona Server for PostgreSQL ](https://docs.percona.com/postgresql/17/index.html), which includes those changes.

The following sections break down the key architectural components of this design.

**a. Customizable** means that `pg_tde` supports many different use cases:

* Encrypting all tables in all databases, or only selected ones
* Storing encryption keys in different external key storage servers, for a list of these see [Key management overview](/docs/tde/upstream/global-key-provider-configuration/overview/)
* Using a single key for a clusters, or different keys for different clusters
* Centralizing all keys in one provider, or splitting them across providers
* Controlling permissions: who manages keys and who can create encrypted or unencrypted tables

**b. Complete** means that `pg_tde` aims to encrypt data at rest.

**c. Data at rest** means everything written to the disk. This includes the following:

* Table data files
* Indexes
* Sequences
* Temporary tables
* Write Ahead Log (WAL)

## Main components {#main-components}

The main components of `pg_tde` are:

* **Core server changes** focus on making the server more extensible, allowing the main logic of `pg_tde` to remain separate, as an extension. Core changes also add encryption-awareness to some command line tools that have to work directly with encrypted tables or encrypted WAL files. 

    You can find the source code [here ](https://github.com/percona/postgres/tree/release-2.3).

* The **`pg_tde` extension** implements the encryption code by hooking into the extension points introduced in the core changes, and the already existing extension points in the PostgreSQL server.

    Everything is controllable with GUC variables and SQL statements, similar to other extensions.

* The **keyring API and libraries** implement the key storage logic with different key providers. The API is internal only, the keyring the libraries are currently part of the main codebase but could be separated into shared libraries in the future.

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

---

Backlinks:

- [Archive WAL](/docs/tde/upstream/command-line-tools/pg-tde-archive-decrypt/)
- [Introduction](/docs/tde/upstream/overview/)
- [2.1.2](/docs/tde/upstream/release-notes/release-notes-v2.1.2/)
