Skip to content

This is the multi-page printable view of this section.

Return to the regular view of this page

Percona pg_tde 2.3.0 upstream manuals

The complete pg_tde documentation, organized from first principles through installation, operations, and reference.

This is the Percona pg_tde 2.3.0 manual. For the paired build, backup tools and major upgrades, see PG TDE on Mimus.

The pg_tde documentation follows the path a production PostgreSQL deployment takes: understand the encryption model, install the extension, configure key custody, validate encrypted tables, then operate WAL, backups, recovery, and upgrades.

The current release is pg_tde 2.3.0, adding PostgreSQL 19 support and pg_tde-aware WAL record inspection. The Chinese edition includes these reviewed incremental changes.

  • Overview — understand TDE, pg_tde, supported deployments, and limitations.
  • Get started — install the package and create the extension.
  • Key management — configure KMS providers and principal keys.
  • Technical reference — architecture, functions, GUC variables, and replication.
  • Operations — backup, restore, enforcement, multi-tenancy, and upgrades.
  • Release notes — follow compatibility and change history.

PG.CENTER edition · Upstream source

1 - Overview

Understand transparent data encryption, pg_tde, supported deployments, and its limits.

This is the Percona pg_tde 2.3.0 manual. For the paired build, backup tools and major upgrades, see PG TDE on Mimus.

PG.CENTER edition · Upstream source

1.1 - About Transparent Data Encryption

An introduction to transparent encryption of data stored on disk.

This is the Percona pg_tde 2.3.0 manual. For the paired build, backup tools and major upgrades, see PG TDE on Mimus.

Transparent Data Encryption (TDE) protects your data at rest by ensuring that even if the underlying storage is compromised, the data remains unreadable without the correct decryption keys. This is especially critical for environments handling sensitive, regulated, or high-value information.

This process runs transparently in the background, with minimal impact on database operations.

Use the links below to explore how pg_tde helps secure your PostgreSQL deployments:

Discover the benefits of pg_tde Understand pg_tde limitations View the full feature list Get started with installation

PG.CENTER edition · Upstream source

1.2 - How pg_tde works

How pg_tde applies encryption within the PostgreSQL storage path.

This is the Percona pg_tde 2.3.0 manual. For the paired build, backup tools and major upgrades, see PG TDE on Mimus.

To encrypt the data, two types of keys are used:

  • Internal encryption keys to encrypt user data. They are stored internally, near the data that they encrypt.
  • The principal key to encrypt database keys. It is kept separately from the database keys and is managed externally in the key management store.
Note

For more information on managing and storing principal keys externally, including supported key management systems and the local keyring option, see Key management overview.

The encryption process works as follows:

image

When a user creates an encrypted table using pg_tde, a new random key is generated internally for that table and is encrypted using the AES-CBC cipher algorithm. This key is used to encrypt all data the user inserts in that table. Eventually the encrypted data gets stored in the underlying storage.

The internal key itself is encrypted using the principal key. The principal key is stored externally in the key management store.

Similarly when the user queries the encrypted table, the principal key is retrieved from the key store to decrypt the internal key. Then the same unique internal key for that table is used to decrypt the data, and unencrypted data gets returned to the user. So, effectively, every TDE table has a unique key, and each table key is encrypted using the principal key.

Understand the encrypted data scope

PG.CENTER edition · Upstream source

1.3 - Benefits of pg_tde

Where database-level encryption complements other protections for stored data.

This is the Percona pg_tde 2.3.0 manual. For the paired build, backup tools and major upgrades, see PG TDE on Mimus.

The benefits of using pg_tde are outlined below for different users and organizations.

Benefits for organizations

  • Data safety: Prevents unauthorized access to stored data, even if backup files or storage devices are stolen or leaked.
  • Enterprise-ready Architecture: Supports both single and multi-tenancy, giving flexibility for SaaS providers or internal multi-user systems.

Benefits for DBAs and engineers

  • Granular control: Encrypt specific tables or databases instead of the entire system, reducing performance overhead.
  • Operational simplicity: Works transparently without requiring major application changes.
  • Defense in depth: Adds another layer of protection to existing controls like TLS (encryption in transit), access control, and role-based permissions.

When combined with the external Key Management Systems (KMS), pg_tde enables centralized control, auditing, and rotation of encryption keys—critical for secure production environments.

See also

You can find more information on Transparent Data Encryption (TDE) in this article.

Learn how pg_tde works

PG.CENTER edition · Upstream source

1.4 - Encrypted data scope

Identify encrypted data files, WAL, and the information that remains unencrypted.

This is the Percona pg_tde 2.3.0 manual. For the paired build, backup tools and major upgrades, see PG TDE on Mimus.

pg_tde encrypts the following components:

  • User data in tables using the extension, including associated TOAST data. The table metadata (column names, data types, etc.) is not encrypted.
  • Temporary tables created during the query execution, for data tables created using the extension.
  • Write-Ahead Log (WAL) data for the entire database cluster. This includes WAL data in encrypted and non-encrypted tables.
  • Indexes on encrypted tables.

Check out the table access methods

PG.CENTER edition · Upstream source

1.5 - Table access methods and pg_tde

Use tde_heap explicitly or as the default access method for new tables.

This is the Percona pg_tde 2.3.0 manual. For the paired build, backup tools and major upgrades, see PG TDE on Mimus.

A table access method is the way how PostgreSQL stores the data in a table. The default table access method is heap. PostgreSQL organizes data in a heap structure, meaning there is no particular order to the rows in the table. Each row is stored independently and identified by its unique row identifier (TID).

How the heap access method works

Insertion: When a new row is inserted, PostgreSQL finds a free space in the tablespace and stores the row there.

Deletion: When a row is deleted, PostgreSQL marks the space occupied by the row as free, but the data remains until it is overwritten by a new insertion.

Updates: PostgreSQL handles updates by deleting the old row and inserting a new row with the updated values.

Custom access method

Custom access methods allow you to implement and define your own way of organizing data in PostgreSQL. This is useful if the default table access method doesn’t meet your needs.

Custom access methods are typically available with PostgreSQL extensions. When you install an extension and enable it in PostgreSQL, a custom access method is created.

An example of such an approach is the tde_heap access method. It is automatically created only for the databases where you enabled the pg_tde extension and configured the key provider, enabling you to encrypt the data.

To use a custom access method, specify the USING clause for the CREATE TABLE command:

CREATE TABLE table_name (
    column1 data_type,
    column2 data_type,
    ...
) USING tde_heap;

How tde_heap works with pg_tde

The tde_heap access method works on top of the default heap access method and is a marker to point which tables require encryption. It uses the custom storage manager TDE SMGR, which becomes active only after you installed the pg_tde extension.

Every data modification operation is first sent to the Buffer Manager, which updates the buffer cache. Then, it is passed to the storage manager, which then writes it to disk. When a table requires encryption, the data is sent to the TDE storage manager, where it is encrypted before written to disk.

Similarly, when a client queries the database, the PostgreSQL core sends the request to the Buffer Manager which checks if the requested data is already in the buffer cache. If it’s not there, the Buffer Manager requests the data from the storage manager. The TDE storage manager reads the encrypted data from disk, decrypts it and loads it to the buffer cache. The Buffer Manager sends the requested data to the PostgreSQL core and then to the client.

Thus, the encryption is done at the storage manager level.

Changing the default table access method

You can change the default table access method so that every table in the entire database cluster is created using the custom access method. For example, you can enable data encryption by default by defining the tde_heap as the default table access method.

However, consider the following before making this change:

  • This is a global setting and applies across the entire database cluster and not just a single database. We recommend setting it with caution because all tables and materialized views created without an explicit access method in their CREATE statement will default to the specified table access method.
  • You must create the pg_tde extension and configure the key provider for all databases before you modify the configuration. Otherwise PostgreSQL won’t find the specified access method and will throw an error.

Here is how you can set the new default table access method:

  1. Add the access method to the default_table_access_method parameter:

    Use ALTER SYSTEM, it requires superuser or ALTER SYSTEM privileges.

    ALTER SYSTEM SET default_table_access_method = tde_heap;

    Edit the postgresql.conf configuration file and add the value for the default_table_access_method parameter.

    default_table_access_method = 'tde_heap'

    You can use the SET command to change the default table access method temporarily, for the current session.

    Unlike modifying the postgresql.conf file or using the ALTER SYSTEM command, the changes you make via the SET command don’t persist after the session ends.

    You also don’t need to have the superuser privileges to run the SET command.

    You can run the SET command anytime during the session.

    SET default_table_access_method = tde_heap;
  2. Reload the configuration to apply the changes:

    SELECT pg_reload_conf();

Understand pg_tde’s limitations

PG.CENTER edition · Upstream source

1.6 - Impact of pg_tde on database operations

What changes for applications, database operations, performance, and upgrades.

This is the Percona pg_tde 2.3.0 manual. For the paired build, backup tools and major upgrades, see PG TDE on Mimus.

This page summarizes how pg_tde interacts with core PostgreSQL operations.

AreaAffectedNotes / Actions
Backups❌ YesEncrypted backups require pg_tde-aware tools. See Backup with WAL encryption.
Restore❌ YesRestored data remains encrypted; pg_tde transparently handles decryption. See Restore encrypted backups.
Streaming replication⚠️ PartialReplicas must load the pg_tde shared library (shared_preload_libraries = ‘pg_tde’). Without it, the replica will fail on operations involving tde_heap.
Logical replication✅ NoNot affected.
Monitoring and statistics✅ NoNot affected, including pg_stat_monitor.
Performance⚠️ SlightMinor CPU overhead due to enabling encryption, most noticeable on random write workloads.

PG.CENTER edition · Upstream source

1.7 - Supported PostgreSQL deployments

Check supported PostgreSQL distributions and the status of each supported major version.

The packages and support matrix below belong to Percona PostgreSQL. Build pg_tde against the matching Mimus installation before enabling it. Mimus procedure

The pg_tde extension is available for Percona Server for PostgreSQL 17.5 and later versions, an open source, drop-in replacement for PostgreSQL Community. These versions provide the tde_heap access method and offer full encryption capabilities, including encryption of tables, indexes and WAL data.

For users who need pg_tde in PostgreSQL 16, a build is available as a Tech Preview. It is not officially supported, is not recommended for production, and does not follow the same release cadence as the supported PostgreSQL 17.5 and later versions.

The extension is tightly integrated with Percona Server for PostgreSQL to deliver enhanced encryption functionality that is not available in community builds.

Why choose Percona Server for PostgreSQL?

By using our PostgreSQL distribution, you get:

  • Full encryption support through the tde_heap access method, including tables, indexes and WAL data.
  • Enhanced performance and enterprise-ready features not available in community builds.
  • Regular updates and security patches backed by Percona’s expert support team.
  • Professional support and guidance for secure PostgreSQL deployments.
Note

Support for earlier or limited versions of pg_tde (such as tde_heap_basic) has been deprecated.

Still unsure which deployment fits your needs? Contact our experts to find the best solution for your environment.

Get started with installation

PG.CENTER edition · Upstream source

1.8 - Limitations of pg_tde

Review unencrypted data, unsupported operations, and WAL tool compatibility.

This is the Percona pg_tde 2.3.0 manual. For the paired build, backup tools and major upgrades, see PG TDE on Mimus.

Known incompatibilities in Percona Server for PostgreSQL

Some PostgreSQL extensions may not work with Percona Server for PostgreSQL due to internal changes required by pg_tde.

These incompatibilities may occur even if pg_tde is not installed or enabled.

Distributed and extension-based systems

Citus and TimescaleDB are not supported

Percona Server for PostgreSQL is not compatible with distributed PostgreSQL extensions such as Citus or time-series extensions such as TimescaleDB.

This limitation is caused by internal PostgreSQL changes related to pg_tde and is not dependent on enabling the extension.

Limitations when using pg_tde

Limitations of pg_tde 2.3.0:

  • PostgreSQL’s internal system tables, which include statistics and metadata, are not encrypted.
  • Temporary files created when queries exceed work_mem are not encrypted. These files may persist during long-running queries or after a server crash which can expose sensitive data in plaintext on disk.

Recovery without pg_tde in shared_preload_libraries

Risk of corruption when recovering encrypted clusters without pg_tde loaded

When recovering a PostgreSQL cluster that contains encrypted tables, the pg_tde extension must be loaded through the shared_preload_libraries configuration parameter.

ALTER DATABASE ... SET TABLESPACE

Changing a database tablespace has limited support with pg_tde

The ALTER DATABASE ... SET TABLESPACE command bypasses PostgreSQL’s storage manager (SMGR), which pg_tde relies on to enforce encryption.

  • If encrypted objects exist in the database’s default tablespace, the operation is refused.
  • If no encrypted objects are present in the default tablespace, the operation is allowed.

Only objects in the default tablespace are checked. Objects in other tablespaces are not evaluated by pg_tde.

To move encrypted tables individually, use ALTER TABLE ... SET TABLESPACE, which operates through SMGR and is compatible with pg_tde.

Currently unsupported WAL tools

The following tools are currently unsupported with pg_tde WAL encryption:

  • pg_createsubscriber
  • pg_receivewal
  • Barman
  • pg_verifybackup by default fails with checksum or WAL key size mismatch errors. As a workaround, use -s (skip checksum) and -n (--no-parse-wal) to verify backups.
  • pgBackRest without pg_tde_archive_decrypt and pg_tde_restore_encrypt, or with archive-async, archive-header-check, or checksum-page enabled.

Supported WAL tools

The following tools have been tested and verified by Percona to work with pg_tde WAL encryption:

  • Patroni, for an example configuration see the following Patroni configuration file
  • pg_tde_basebackup (with --wal-method=stream or --wal-method=none), for details on using pg_tde_basebackup with WAL encryption, see Backup with WAL encryption enabled
  • pg_tde_resetwal
  • pg_tde_rewind
  • pg_tde_upgrade
  • pg_tde_waldump
  • pgBackRest, when pg_tde_archive_decrypt and pg_tde_restore_encrypt are configured and archive-async, archive-header-check, and checksum-page are disabled

Example Patroni configuration

The following is a Percona-tested example configuration.

Click to expand the Percona-tested Patroni configuration
# Example Patroni configuration file maintained by Percona
# Source: https://github.com/jobinau/pgscripts/blob/main/patroni/patroni.yml
scope: tde
name: pg1
restapi:
  listen: 0.0.0.0:8008
  connect_address: pg1:8008
etcd3:
  host: etcd1:2379
bootstrap:
  dcs:
    ttl: 30
    loop_wait: 10
    retry_timeout: 10
    maximum_lag_on_failover: 1048576
    postgresql:
      use_pg_rewind: true
      use_slots: true
      parameters:
        archive_command: "/lib/postgresql/17/bin/pg_tde_archive_decrypt %f %p \"pgbackrest --stanza=tde archive-push %%p\""
        archive_timeout: 600s
        archive_mode: "on"
        logging_collector: "on"
        restore_command: "/lib/postgresql/17/bin/pg_tde_restore_encrypt %f %p \"pgbackrest --stanza=tde archive-get %%f \\\"%%p\\\"\""
      pg_hba:
        - local all all peer
        - host all all 0.0.0.0/0 scram-sha-256
        - host all all ::/0 scram-sha-256
        - local replication all peer
        - host replication all 0.0.0.0/0 scram-sha-256
        - host replication all ::/0 scram-sha-256
  initdb:
    - encoding: UTF8
    - data-checksums
    - set: shared_preload_libraries=pg_tde
  post_init: /usr/local/bin/setup_cluster.sh
postgresql:
  listen: 0.0.0.0:5432
  connect_address: pg1:5432
  data_dir: /var/lib/postgresql/patroni-17
  bin_dir: /lib/postgresql/17/bin
  bin_name:
    pg_basebackup: pg_tde_basebackup
    pg_rewind: pg_tde_rewind
  pgpass: /var/lib/postgresql/patronipass
  authentication:
    replication:
      username: replicator
      password: <replication-password>
    superuser:
      username: postgres
      password: <superuser-password>
  parameters:
    unix_socket_directories: /tmp
    # Use unix_socket_directories: /var/run/postgresql for Debian/Ubuntu distributions
watchdog:
  mode: off
tags:
  nofailover: false
  noloadbalance: false
  clonefrom: false
  nosync: false
Warning

The above example is Percona-tested, but Patroni versions differ, especially with discovery backends such as etcd. Ensure you adjust the configuration to match your environment, version, and security requirements.

Next steps

Check which PostgreSQL versions and deployment types are compatible with pg_tde before planning your installation.

View the versions and supported deployments

Begin the installation process when you’re ready to set up encryption.

Start installing pg_tde

PG.CENTER edition · Upstream source

2 - pg_tde documentation

Explore pg_tde capabilities, its PostgreSQL integration, and the documentation paths.

This is the Percona pg_tde 2.3.0 manual. For the paired build, backup tools and major upgrades, see PG TDE on Mimus.

Percona Transparent Data Encryption for PostgreSQL (pg_tde) is an open source, community driven and futureproof PostgreSQL extension that provides Transparent Data Encryption (TDE) to protect data at rest. pg_tde ensures that the data stored on disk is encrypted, and that no one can read it without the proper encryption keys, even if they gain access to the physical storage media.

pg_tde is bundled as a component of Percona Server for PostgreSQL and requires its patches to function. It is packaged with Percona Distribution for PostgreSQL 17+ to ensure compatibility and proper operation. For more information, see the Percona Distribution for PostgreSQL 18 documentation .

Installation guide

Get started quickly with the step-by-step installation instructions.

How to install pg_tde

🚀 Features

Explore what features Percona’s pg_tde extension brings to PostgreSQL.

Check what you can do with pg_tde

Architecture

Understand how pg_tde integrates into PostgreSQL with Percona’s architecture. Learn how keys are managed, how encryption is applied, and how our design ensures performance and security.

Check what’s under the hood for pg_tde

📢 What’s new?

Learn about the releases and changes in pg_tde.

Check what’s new in the latest version

PG.CENTER edition · Upstream source

3 - Features

An inventory of encryption capabilities, supported access methods, and PostgreSQL integration.

This is the Percona pg_tde 2.3.0 manual. For the paired build, backup tools and major upgrades, see PG TDE on Mimus.

pg_tde is available for Percona Server for PostgreSQL The Percona Server for PostgreSQL provides an extended Storage Manager API that allows integration with custom storage managers.

The following features are available for the extension:

  • Table encryption, including:
    • Data tables
    • Index data for encrypted tables
    • TOAST tables
    • Temporary tables
Note

Metadata of those tables is not encrypted.

Next steps

Learn more about how pg_tde implements Transparent Data Encryption:

About Transparent Data Encryption

PG.CENTER edition · Upstream source

4 - Install pg_tde

Choose packages, containers, Kubernetes, or a source archive for your PostgreSQL deployment.

The packages and support matrix below belong to Percona PostgreSQL. Build pg_tde against the matching Mimus installation before enabling it. Mimus procedure

You can select from multiple easy-to-follow installation options to install pg_tde, however we strongly recommend using a Package Manager for a convenient and quick installation.

pg_tde availability by PostgreSQL version:

PostgreSQL versionIs pg_tde installed automatically?Action Required
17.x - 17.6 (minor updates)YesNone
17.7 (and later)NoInstall the package manually
18.x (and later)NoInstall the package manually
Important

Starting with PPG 17.7, pg_tde is no longer bundled with the Percona server for PostgreSQL package. It is now delivered as a separate package named percona-pg-tde(pg-version) for Debian or Ubuntu and percona-pg_tde(pg-version) for Red Hat Enterprise Linux and Derivatives.

Note

Specific information on the supported platforms, products, and versions is described in the Percona Software and Platform Lifecycle page.

Next steps

After finishing the installation, you can proceed with:

Set up pg_tde Learn about key management Validate your encryption setup Enable WAL encryption

PG.CENTER edition · Upstream source

5 - Install pg_tde on Debian or Ubuntu

Install the separate pg_tde package from Percona’s Debian and Ubuntu repositories.

The packages and support matrix below belong to Percona PostgreSQL. Build pg_tde against the matching Mimus installation before enabling it. Mimus procedure

This page explains how to install pg_tde for Percona Distribution for PostgreSQL .

Tip

Check the list of supported platforms before continuing.

Preconditions

  1. Remove any upstream PostgreSQL packages (postgresql-*) that may already be installed on Debian or other apt-based systems. These packages conflict with Percona Server for PostgreSQL and with the standalone pg_tde package.
  2. Ensure you enable the Percona APT repository using the repository management tool percona-release. This ensures the correct Percona Server for PostgreSQL and pg_tde packages are available for installation.

Install percona-release

  1. You need the following dependencies to install percona-release:

    • wget
    • gnupg2
    • curl
    • lsb-release

    Install the dependencies:

    sudo apt-get install -y wget gnupg2 curl lsb-release
  2. Fetch the percona-release package

    sudo wget https://repo.percona.com/apt/percona-release_latest.generic_all.deb
  3. Install percona-release

    sudo dpkg -i percona-release_latest.generic_all.deb
  4. Enable the Percona Distribution for PostgreSQL repository

    sudo percona-release enable-only ppg-18
  5. Update the local cache

    sudo apt-get update

Install pg_tde

After all preconditions are met, install the pg_tde package:

sudo apt-get install -y percona-pg-tde(pg-version)

Example for PostgreSQL 18

sudo apt-get install -y percona-pg-tde18

Next steps

Configure pg_tde

PG.CENTER edition · Upstream source

6 - Install pg_tde on Red Hat Enterprise Linux and Derivatives

Install the pg_tde RPM package on Red Hat Enterprise Linux and compatible distributions.

The packages and support matrix below belong to Percona PostgreSQL. Build pg_tde against the matching Mimus installation before enabling it. Mimus procedure

This tutorial shows how to install pg_tde with Percona Distribution for PostgreSQL.

Tip

Check the list of supported platforms before continuing.

Install percona-release

You need the percona-release repository management tool that enables the desired Percona repository for you.

  1. Install percona-release:

    sudo yum -y install https://repo.percona.com/yum/percona-release-latest.noarch.rpm
  2. Enable the repository:

    sudo percona-release enable-only ppg-18

Install pg_tde

Install pg_tde:

sudo yum install -y percona-pg_tde(pg-version)

Example for PostgreSQL 18

sudo yum install -y percona-pg_tde18

Next steps

Configure pg_tde

PG.CENTER edition · Upstream source

7 - Configure pg_tde

Preload the library, restart PostgreSQL, and enable the extension in a database.

The packages and support matrix below belong to Percona PostgreSQL. Build pg_tde against the matching Mimus installation before enabling it. Mimus procedure

Before you can use pg_tde for data encryption, you must enable the extension and configure PostgreSQL to load it at startup. This setup ensures that the necessary hooks and shared memory are available for encryption operations.

Note

To learn how to configure multi-tenancy, refer to the Configure multi-tenancy guidelines.

The pg_tde extension requires additional shared memory. You need to configure PostgreSQL to preload it at startup.

1. Configure shared_preload_libraries

You can configure the shared_preload_libraries parameter in two ways:

  • Add the following line to the postgresql.conf file:

    shared_preload_libraries = 'pg_tde'
  • Use the ALTER SYSTEM command. Run the following command in psql as a superuser:

    ALTER SYSTEM SET shared_preload_libraries = 'pg_tde';

2. Restart the PostgreSQL cluster

Restart the postgresql cluster to apply the configuration.

  • On Debian and Ubuntu:

     ```sh
     sudo systemctl restart postgresql.service
     ```
    
  • On RHEL and derivatives:

     ```sh
     sudo systemctl restart postgresql-17
     ```
    

3. Create the extension

After restarting PostgreSQL, connect to psql as a superuser or database owner and run:

CREATE EXTENSION pg_tde;

See CREATE EXTENSION for more details.

Note

The pg_tde extension is created only for the current database. To enable it for other databases, you must run the command in each individual database.

4. (Optional) Enable pg_tde by default

To automatically have pg_tde enabled for all new databases, modify the template1 database:

psql -d template1 -c 'CREATE EXTENSION pg_tde;'
Note

It’s recommended to use an external key provider (KMS) to manage encryption keys. For configuration instructions, see Next steps.

Next steps

Configure Key Management (KMS)

PG.CENTER edition · Upstream source

8 - Validate Encryption with pg_tde

Create or convert a table with tde_heap and verify its encryption status.

This is the Percona pg_tde 2.3.0 manual. For the paired build, backup tools and major upgrades, see PG TDE on Mimus.

After enabling the pg_tde extension for a database, you can begin encrypting data using the tde_heap table access method.

Encrypt data in a new table

  1. Create a table in the database for which you have enabled pg_tde using the tde_heap access method as follows:

    CREATE TABLE <table_name> (<field> <datatype>) USING tde_heap;

    Warning: Example for testing purposes only:

    CREATE TABLE albums (
        album_id INTEGER GENERATED ALWAYS AS IDENTITY PRIMARY KEY,
        artist_id INTEGER,
        title TEXT NOT NULL,
        released DATE NOT NULL
    ) USING tde_heap;

    Learn more about table access methods and how you can enable data encryption by default in the Table Access Methods and TDE section.

  2. To check if the data is encrypted, run the following function:

    SELECT pg_tde_is_encrypted('table_name');

    The function returns true or false.

  3. (Optional) Rotate the principal key.

To re-encrypt the data using a new key, see Principal key management.

Encrypt existing table

You can encrypt an existing table. It requires rewriting the table, so for large tables, it might take a considerable amount of time.

Run the following command:

ALTER TABLE table_name SET ACCESS METHOD tde_heap;
Important

Using SET ACCESS METHOD drops hint bits which can impact query performance. To restore performance, run:

SELECT count(*) FROM table_name;

This forces PostgreSQL to check every tuple for visibility and reset the hint bits.

Tip

Want to remove encryption later? See how to decrypt your data.

Next steps

Configure WAL encryption

PG.CENTER edition · Upstream source

9 - Key management

Configure keyring files and external key management systems.

This is the Percona pg_tde 2.3.0 manual. For the paired build, backup tools and major upgrades, see PG TDE on Mimus.

PG.CENTER edition · Upstream source

9.1 - Key management overview

Choose a supported KMS and understand principal keys, provider scope, and deployment requirements.

This is the Percona pg_tde 2.3.0 manual. For the paired build, backup tools and major upgrades, see PG TDE on Mimus.

Editorial correction

This overview retains an older qualification of Vault KMIP. The 2.2.2 release notes explicitly announce Vault Enterprise KMIP support; consult those notes for the version-specific status. See site errata.

In production environments, storing encryption keys locally on the PostgreSQL server can introduce security risks. To enhance security, pg_tde supports integration with external Key Management Systems (KMS) through a Global Key Provider interface.

This section describes how you can configure pg_tde to use the local and external key providers.

To use an external KMS with pg_tde:

  1. Configure a Key Provider
  2. Set the Global Principal Key
Note

While key files may be acceptable for local or testing environments, KMS integration is the recommended approach for production deployments.

Important

When using HashiCorp Vault, KV v2 is the recommended and supported integration method.

The KMIP engine in Vault is not a validated configuration for pg_tde and is not recommended for production deployments.

Warning

Do not rotate encryption keys while a backup is running. This may result in an inconsistent backup and restore failure. This applies to all backup tools.

Schedule key rotations outside backup windows. After rotating keys, take a new full backup.

For more details, see Limitations of pg_tde.

pg_tde has been tested with the following key providers:

KMS ProviderDescriptionDocumentation
KMIPStandard Key Management Interoperability Protocol.Configure KMIP →
VaultHashiCorp Vault integration (KV v2 API).Configure Vault →
FortanixFortanix DSM key management.Configure Fortanix →
ThalesThales CipherTrust Manager and DSM.Configure Thales →
OpenBaoCommunity fork of Vault, supporting KV v2.Configure OpenBao →
AkeylessA cloud-based secrets management platform for securely storing and accessing credentials and encryption keys.Configure Akeyless →
Keyring file (not recommended)Local key file for dev/test only.Configure keyring file →

PG.CENTER edition · Upstream source

9.2 - Keyring file configuration

Configure a plaintext file keyring for local development and testing.

This is the Percona pg_tde 2.3.0 manual. For the paired build, backup tools and major upgrades, see PG TDE on Mimus.

Editorial correction

The inspection example now uses the table it creates and the current database key-info function. See site errata.

This setup is intended for development and stores the keys, unencrypted, in a data file you specify.

Note

While keyring files may be acceptable for local or testing environments, proper KMS providers are the recommended approach for production deployments.

You can configure key providers either at the database level (for development and testing) or at the global level (for production).

The steps below provide an example on how to add a database-scoped key provider:

  1. Create a database-scoped file key provider (file-keyring in this example) in the /tmp/pg_tde_test_local_keyring.per file:

    SELECT pg_tde_add_database_key_provider_file(
        'file-keyring',
        '/tmp/pg_tde_test_local_keyring.per'
    );
  2. Create a key (my_default_key in this example) inside the newly created file-keyring provider:

    SELECT pg_tde_create_key_using_database_key_provider(
        'my_default_key',
        'file-keyring'
    );
  3. Set the key (my_default_key) from the key provider (file-keyring):

    SELECT pg_tde_set_key_using_database_key_provider(
        'my_default_key',
        'file-keyring'
    );
    Tip

    You can check the current database key information (such as the date and time of creation). Run:

    SELECT pg_tde_key_info();
  4. Now, create a table using tde_heap:

    CREATE TABLE customer_table (a INT) USING tde_heap;

    The newly created table is encrypted with the database key you have set (my_default_key).

    Tip

    To check if your created table is encrypted with tde_heap, run:

    \d+ customer_table

    If Access method: tde_heap, then your table is encrypted.

    Example output

    postgres=# \d+ customer_table Table “public.customer_table” Column | Type | Collation | Nullable | Default | Storage | Compression | Stats target | Description ——–+———+———–+———-+———+———+————-+————–+————- a | integer | | | | plain | | | Access method: tde_heap

Further reading

Next, for production deployments, configure a global principal key using a proper KMS provider.

Alternatively, you can skip directly to validating encryption with pg_tde or configuring WAL encryption.

You can also review the available pg_tde functions in Functions.

PG.CENTER edition · Upstream source

9.3 - Vault configuration

Connect pg_tde to a HashiCorp Vault KV v2 secrets engine.

This is the Percona pg_tde 2.3.0 manual. For the paired build, backup tools and major upgrades, see PG TDE on Mimus.

You can configure pg_tde to use HashiCorp Vault as a global key provider for managing encryption keys securely. Both the open source and enterprise editions are supported.

Configure Vault with pg_tde in Docker

This example setup describes how to run HashiCorp Vault and Percona PostgreSQL with pg_tde side by side using Docker, configure Vault policies, and connect it as a global key provider for TDE encryption.

Note

For production deployments, follow your organization’s security standards.

1. Create the docker-compose.yaml file

The following docker-compose.yaml file is an example on how to run both Vault and PostgreSQL with a shared secrets volume:

docker-compose.yaml (example file)
version: '3.8'

services:
vault:
    image: hashicorp/vault:latest
    container_name: vault
    ports:
    - "8200:8200"
    volumes:
    - ./vault-config.hcl:/vault/config/vault-config.hcl
    - ./vault-data:/vault/data
    - shared-secrets:/vault/secrets
    environment:
    VAULT_ADDR: http://127.0.0.1:8200
    command: vault server -config=/vault/config/vault-config.hcl

pg:
    image: percona/percona-distribution-postgresql:17.5-2
    container_name: pg
    ports:
    - "5432:5432"
    environment:
    POSTGRES_PASSWORD: secret
    ENABLE_PG_TDE: "1"
    volumes:
    - ./pgdata:/var/lib/postgresql/data
    - shared-secrets:/etc/postgresql/secrets:ro
    depends_on:
    - vault

volumes:
shared-secrets:

2. Enable the KV v2 secrets engine

In the Vault container, enable a KV v2 storage engine for pg_tde:

vault secrets enable -path=tde -version=2 kv

This creates a tde/ mount for storing encrypted keys.

Vault namespaces (Enterprise) and mounts

If you are using Vault Enterprise namespaces, you don’t need a separate namespace parameter when configuring pg_tde.

You can include the namespace directly in the mount path. For example:

SELECT pg_tde_add_global_key_provider_vault_v2(
    'vault-ns',
    'https://127.0.0.1:8200',
    'pgns/tde/data/global-key',
    '/etc/postgresql/secrets/vault_token.txt',
    NULL
);

This is equivalent to configuring a namespace separately and works with both:

  • Vault OSS
  • Vault Enterprise (with namespaces)

3. Create a Vault policy for pg_tde

Define a Vault policy that grants pg_tde access to read, write, and list keys.

vault policy write tde-policy - <<EOF
path "tde/data/*" {
  capabilities = ["read", "create", "update", "list"]
}

path "tde/metadata/*" {
  capabilities = ["read", "list"]
}
EOF

This allows pg_tde to:

  • read, create, and update encryption keys
  • list and access metadata for the tde/ path
Tip

If you encounter the following error:

ERROR: failed to get mount info for "http://vault:8200" at mountpoint ...

Ensure your Vault policy includes the following path:

path "sys/mounts/*" {
  capabilities = ["read"]
}

This allows pg_tde to read the mount metadata from Vault.

4. Create an Authentication Method and Token

Enable the AppRole authentication method:

vault auth enable approle
vault write auth/approle/role/tde-role policies="tde-policy"

Generate a token associated with the tde-policy:

vault token create -policy="tde-policy"

Example output:

Key                  Value
token                hvs.{secret_code}
token_policies       ["default" "tde-policy"]

5. Share the token with PostgreSQL

Copy the generated token into the shared secrets directory (shared secrets volume) so PostgreSQL can use it:

echo "hvs.secret_code" > /vault/secrets/vault_token.txt
Tip

You can access this file in PostgreSQL at /etc/postgresql/secrets/vault_token.txt.

6. Register Vault as a global key provider in PostgreSQL

In the PostgreSQL container, connect pg_tde to Vault using:

SELECT pg_tde_add_global_key_provider_vault_v2(
  'vault-provider',
  'http://vault:8200',
  'tde/data/global-key',
  '/etc/postgresql/secrets/vault_token.txt',
  NULL
);

7. Create and set the global master key

Create the global master key:

SELECT pg_tde_create_key_using_global_key_provider(
  'global-master-key',
  'vault-provider'
);

Then set it:

SELECT pg_tde_set_default_key_using_global_key_provider(
  'global-master-key',
  'vault-provider'
);

8. Test encryption with a sample table

Create a sample table:

CREATE TABLE secure_data (
  id INTEGER GENERATED ALWAYS AS IDENTITY PRIMARY KEY,
  name TEXT,
  amount NUMERIC(10,2),
  created_at DATE
) USING tde_heap;

Then insert data into the table:

INSERT INTO secure_data (name, amount, created_at) VALUES
('Alice', 1234.56, '2025-08-01'),
('Bob', 7890.12, '2025-08-10'),
('Charlie', 345.67, '2025-08-19');

Query the table and confirm that the encryption is functioning:

select * from secure_data;
 id |  name   | amount  | created_at
----+---------+---------+------------
  1 | Alice   | 1234.56 | 2025-08-01
  2 | Bob     | 7890.12 | 2025-08-10
  3 | Charlie |  345.67 | 2025-08-19
(3 rows)

Example global key provider usage

SELECT pg_tde_add_global_key_provider_vault_v2(
    'provider-name',
    'url',
    'mount',
    'secret_token_path',
    'ca_path'
);

Parameter descriptions

  • provider-name is the name to identify this key provider
  • secret_token_path is a path to the file that contains an access token with read and write access to the above mount point
  • url is the URL of the Vault server
  • mount is the mount point where the keyring should store the keys
  • [optional] ca_path is the path of the CA file used for SSL verification

The following example is for testing purposes only. Use secure tokens and proper SSL validation in production environments:

SELECT pg_tde_add_global_key_provider_vault_v2(
    'my-vault',
    'https://vault.vault.svc.cluster.local:8200',
    'secret/data',
    '/path/to/token_file',
    '/path/to/ca_cert.pem'
);

For more information on related functions, see Function Reference.

Required permissions

The PostgreSQL instance requires the following Vault API capabilities to manage and read encryption keys:

  • sys/mounts/<mount>/* - read permissions
  • <mount>/data/* - create, read permissions
  • <mount>/metadata/* - list permissions
Note

For more information on Vault permissions, see the following documentation.

Next steps

Global Principal Key Configuration

PG.CENTER edition · Upstream source

9.4 - Using OpenBao as a key provider

Configure an OpenBao secrets engine, token, and pg_tde key provider.

This is the Percona pg_tde 2.3.0 manual. For the paired build, backup tools and major upgrades, see PG TDE on Mimus.

You can configure pg_tde to use OpenBao as a global key provider for managing encryption keys securely.

Note

This guide assumes that your OpenBao server is already set up and accessible. OpenBao configuration is outside the scope of this document, see OpenBao’s official documentation for more information.

Example usage

To register an OpenBao server as a global key provider:

SELECT pg_tde_add_global_key_provider_vault_v2(
    'provider-name',
    'url',
    'mount',
    'secret_token_path',
    'ca_path',
    'namespace'
);

Parameter descriptions

  • provider-name is the name to identify this key provider
  • secret_token_path is a path to the file that contains an access token with read and write access to the above mount point
  • url is the URL of the OpenBao server
  • mount is the mount point where the keyring should store the keys
  • [optional] ca_path is the path of the CA file used for SSL verification
  • [optional] namespace is the namespace within the OpenBao server. Read more about the namespace support in OpenBao` (NOTE: You can use a namespace without ca_path. In this case, specify NULL as the ca_path value)

The following example is for testing purposes only. Use secure tokens and proper SSL validation in production environments:

SELECT pg_tde_add_global_key_provider_vault_v2(
    'my-openbao-provider',
    'https://openbao.example.com:8200',
    'secret/data',
    '/path/to/token_file',
    '/path/to/ca_cert.pem'
);

For more information on related functions, see the link below:

Percona pg_tde Function Reference

Next steps

Global Principal Key Configuration

PG.CENTER edition · Upstream source

9.5 - KMIP configuration

Configure a KMIP endpoint, client credentials, and key provider.

This is the Percona pg_tde 2.3.0 manual. For the paired build, backup tools and major upgrades, see PG TDE on Mimus.

Editorial correction

This overview retains an older qualification of Vault KMIP. The 2.2.2 release notes explicitly announce Vault Enterprise KMIP support; consult those notes for the version-specific status. See site errata.

To use a Key Management Interoperability Protocol (KMIP) server with pg_tde, you must configure it as a global key provider. This setup enables pg_tde to securely fetch and manage encryption keys from a centralized key management appliance.

Important

When using HashiCorp Vault as a KMIP server, this configuration is not a validated deployment model for pg_tde and is not recommended for production use.

For Vault-based key management, use the KV v2 integration instead.

Note

You need the root certificate of the KMIP server and a client key/certificate pair with permissions to create and read keys on the server.

For testing purposes, you can use a Eviden KMS server, which enables easy certificate generation and basic KMIP behavior. If you’re using a production-grade KMIP server, ensure you obtain valid, trusted certificates from the key management appliance.

Example usage

SELECT pg_tde_add_global_key_provider_kmip(
    'provider-name',
    'kmip-IP', 
    `port`,
    '/path_to/server_certificate.pem', 
    '/path_to/client_cert.pem',
    '/path_to/client_key.pem'
);

Parameter descriptions

  • provider-name is the name of the provider. You can specify any name, it’s for you to identify the provider
  • kmip-IP is the IP address of a domain name of the KMIP server
  • port is the port to communicate with the KMIP server. Typically used port is 5696
  • server-certificate is the path to the certificate file for the KMIP server
  • client_cert is the path to the client certificate.
  • client_key is the path to the client key.

The following example is for testing purposes only.

SELECT pg_tde_add_global_key_provider_kmip(
    'kmip','127.0.0.1', 
    5696, 
    '/tmp/server_certificate.pem', 
    '/tmp/client_cert_jane_doe.pem',
    '/tmp/client_key_jane_doe.pem'
);

For more information on related functions, see the link below:

Percona pg_tde Function Reference

Next steps

Global Principal Key Configuration

PG.CENTER edition · Upstream source

9.6 - Thales KMIP server configuration

Connect pg_tde to Thales CipherTrust Manager through KMIP.

This is the Percona pg_tde 2.3.0 manual. For the paired build, backup tools and major upgrades, see PG TDE on Mimus.

pg_tde is compatible with the Thales CipherTrust Manager via the KMIP protocol. For a full setup guide, see the Thales documentation.

For more information on adding or modifying the provider, see the Adding or modifying KMIP providers topic.

PG.CENTER edition · Upstream source

9.7 - Fortanix KMIP server configuration

Prepare a Fortanix DSM security object, certificate, and KMIP endpoint.

This is the Percona pg_tde 2.3.0 manual. For the paired build, backup tools and major upgrades, see PG TDE on Mimus.

pg_tde is compatible with Fortanix Data Security Manager (DSM) via the KMIP protocol. For a full setup guide, see the Fortanix KMIP documentation here.

For more information on adding or modifying the provider, see the Adding or modifying KMIP providers topic.

PG.CENTER edition · Upstream source

9.8 - Akeyless KMIP server configuration

Create Akeyless KMIP credentials and connect a pg_tde key provider.

This is the Percona pg_tde 2.3.0 manual. For the paired build, backup tools and major upgrades, see PG TDE on Mimus.

pg_tde is compatible with the Akeyless CipherTrust Manager via the KMIP protocol. For a full setup guide, see the Akeyless documentation .

For more information on adding or modifying the provider, see the Add or modify KMIP providers topic.

Next steps

Global Principal Key Configuration

PG.CENTER edition · Upstream source

9.9 - Default principal key configuration

Assign a default principal key to databases without their own configured key.

This is the Percona pg_tde 2.3.0 manual. For the paired build, backup tools and major upgrades, see PG TDE on Mimus.

You can configure a default principal key for the server using a global key provider. This key is used by all databases that do not have their own encryption keys configured.

Configuring the default principal key is a multi-step process that uses the following functions:

Add a global key provider

To add a global key provider, see the Key provider management topic.

Create a default principal key

Note

The sample output below is for demonstration purposes only. Be sure to replace the key name and provider with your actual values.

To create a global principal key, run:

SELECT pg_tde_create_key_using_global_key_provider(
    'key-name',
    'global_vault_provider'
);
Sample output
    postgres=# SELECT pg_tde_create_key_using_global_key_provider(
        'keytest1',
        'file-keyring'
    );
    pg_tde_create_key_using_global_key_provider
    ---------------------------------------------

    (1 row)

Set a default principal key

To set a default principal key, run:

SELECT pg_tde_set_default_key_using_global_key_provider(
    'key-name',
    'global_vault_provider'
);
Sample output
    postgres=# SELECT pg_tde_set_default_key_using_global_key_provider(
        'keytest1',
        'file-keyring'
    );
    pg_tde_set_default_key_using_global_key_provider 
    --------------------------------------------------

    (1 row)

Parameter description

  • key-name is the name under which the principal key is stored in the provider.
  • global_vault_provider is the name of the global key provider you previously configured.
Note

If no error is reported, the action completed successfully.

How key generation works

The key material (actual cryptographic key) is auto-generated by pg_tde and stored securely by the configured provider.

Note

This process sets the default principal key for the entire server. Any database without a key explicitly configured will fall back to this key.

Next steps

To confirm that encryption is working as expected, follow the validation steps:

Validate Encryption with pg_tde

PG.CENTER edition · Upstream source

10 - Architecture

Learn how pg_tde encrypts data, manages keys, and integrates with PostgreSQL.

This is the Percona pg_tde 2.3.0 manual. For the paired build, backup tools and major upgrades, see PG TDE on Mimus.

PG.CENTER edition · Upstream source

10.1 - Architecture overview

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

This is the Percona pg_tde 2.3.0 manual. For the paired build, backup tools and major upgrades, see PG TDE on Mimus.

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 , 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
  • 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

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 .

  • 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 · Upstream source

10.2 - Encryption architecture

How internal keys, principal keys, AES ciphers, and WAL encryption fit together.

This is the Percona pg_tde 2.3.0 manual. For the paired build, backup tools and major upgrades, see PG TDE on Mimus.

This section explains how pg_tde implements encryption inside PostgreSQL. It covers the key hierarchy, supported encryption algorithms, encryption workflow, and the core changes that make it possible to encrypt tables, WAL, and other database files.

Together, these components form the foundation of data-at-rest encryption in pg_tde.

Two-key hierarchy

Database principal key and internal keys

pg_tde uses two kinds of keys for encryption:

  1. Internal keys to encrypt the data. They are stored in PostgreSQL’s data directory under $PGDATA/pg_tde
  2. Principal keys, which encrypt internal keys, are stored externally in a Key Management System (KMS) using the key provider API

pg_tde uses one principal key per database. Every internal key for the given database is encrypted using this principal key.

Internal keys are used for specific database files: each file with a different Object Identifier (OID) has a different internal key.

Example:

A table with 4 indexes will have at least 5 internal keys, one for the table and one for each index. Additional associated relations, such as sequences or a TOAST table, also have their own keys.

Encryption algorithm

pg_tde currently uses the following encryption algorithms:

  • AES-128-CBC, AES-256-CBC for encrypting database files; encrypted with internal keys
  • AES-128-CTR, AES-256-CTR for WAL encryption; encrypted with internal keys
  • AES-128-GCM, AES-256-GCM for encrypting internal keys; encrypted with the principal key

Encryption workflow

You can use pg_tde to encrypt entire databases or only selected tables.

To support this without metadata changes, encrypted tables are labeled with the tde_heap access method marker.

The tde_heap access method is functionally identical to the heap access method. This allows pg_tde to distinguish between encrypted (tde_heap) and non-encrypted (heap) tables.

The initial decision about encryption is made using the postgres event trigger mechanism:

  • When the tde_heap clause is used for CREATE TABLE or ALTER TABLE statements, then the newly created data files are marked as encrypted
  • After this, the file operations encrypt or decrypt the data

Subsequent decisions are done using a slightly modified Storage Manager (SMGR) API:

  • When a database file is re-created with a different ID as a result of a TRUNCATE or a VACUUM FULL command, the newly created file inherits the encryption information
  • The file is then either encrypted or left unencrypted based on that inheritance

WAL encryption functionality

You can control WAL encryption globally via the pg_tde.wal_encrypt GUC variable, which requires a server restart.

WAL keys also contain the LSN of the first WAL write after key creation. This allows pg_tde to know which WAL ranges are encrypted or not and with which key.

Note

See the Configure WAL encryption chapter for more information.

The setting only controls writes so that only WAL writes are encrypted when WAL encryption is enabled. This means that WAL files can contain both encrypted and unencrypted data, depending on what the status of this variable was when writing the data.

pg_tde keeps track of the encryption status of WAL records using internal keys. When the server is restarted it writes a new internal key if WAL encryption is enabled, or if it is disabled and was previously enabled it writes a dummy key signaling that WAL encryption ended.

With this information the WAL reader code can decide if a specific WAL record has to be decrypted or not and which key it should use to decrypt it.

Encrypting other access methods

Currently pg_tde only encrypts heap tables and other files such as indexes, TOAST tables, sequences that are related to the heap tables.

Indexes include any kind of index that goes through the SMGR API, not just the built-in indexes in PostgreSQL.

Other table access methods that use the SMGR API could also be encrypted. This requires adding a marker access method and extending the event triggers, using the same approach as with heap tables.

Storage Manager (SMGR) API

pg_tde relies on a slightly modified version of the SMGR API. These modifications include:

  • Making the API generally extensible, where extensions can inject custom code into the storage manager
  • Adding tracking information for files. When a new file is created for an existing relation, references to the existing file are also passed to the SMGR functions

With these modifications, pg_tde implements an additional layer on top of the normal Magnetic Disk SMGR API: if the related table is encrypted, pg_tde encrypts a file before writing it to the disk and, similarly, decrypts it after reading when needed.

WAL encryption

WAL encryption is implemented through a separate, server-wide mechanism that extends PostgreSQL WAL-related APIs. Similar to the SMGR integration, this relies on additional extensions to PostgreSQL core APIs to support encryption of WAL records.

For configuration details, see Configure WAL encryption.

PG.CENTER edition · Upstream source

10.3 - Key and key provider management

How key scope, provider storage, privileges, and key rotation work.

This is the Percona pg_tde 2.3.0 manual. For the paired build, backup tools and major upgrades, see PG TDE on Mimus.

pg_tde uses a hierarchy of principal and internal keys to encrypt database files. This chapter covers how to manage these keys, including rotation, regeneration, storage, and key provider configuration, so you can keep your encrypted data secure and accessible.

Principal key rotation

You can rotate principal keys to comply with common policies and to handle situations with potentially exposed principal keys.

Rotation means that pg_tde generates a new version of the principal key, and re-encrypts the associated internal keys with the new key. The old principal key is kept as is at the same location, because it may still be needed to decrypt backups or other databases.

Internal key regeneration

Internal keys for tables, indexes and other data files are generated once a file is created. There’s no way to re-encrypt a file.

There are workarounds for this, because operations that move the table data to a new file, such as VACUUM FULL or an ALTER TABLE that rewrites the file will create a new key for the new file, essentially rotating the internal key. This however means taking an exclusive lock on the table for the duration of the operation, which might not be desirable for huge tables.

WAL internal keys are fixed once created. Every time the server (re)starts, a new WAL key is generated. If WAL encryption is enabled (using pg_tde.wal_encrypt), all WAL writes following the creation of the new key are encrypted with it until another key is generated at the next restart. This ensures that each WAL segment uses a consistent encryption key, without requiring you to manage key rotation manually.

Internal key storage

Internal keys and pg_tde metadata in general are kept in a single $PGDATA/pg_tde directory. This directory stores separate files for each database, such as:

  • Encrypted internal keys and internal key mapping to tables
  • Information about the key providers

Also, the $PGDATA/pg_tde directory has a special global section marked with the OID 1664, which includes the global key providers and global internal keys.

The global section is used for WAL encryption. Specific databases can use the global section too, for scenarios where users configure individual principal keys for databases but use the same global key provider. For this purpose, you must enable the global provider inheritance.

The global default principal key uses the special OID 1663.

Key providers (principal key storage)

In pg_tde, a Key Management System (KMS) is treated as an external key provider. Key providers store and serve the principal keys that pg_tde uses for encryption and decryption.

When you configure a key provider, pg_tde:

  • Uploads new principal keys when they are created
  • Retrieves principal keys from the provider when needed for decryption (for example, at startup or restart)
  • Caches retrieved keys to reduce repeated lookups
Note

Each key provider requires a detailed configuration, including the service address and authentication information.

For a complete list of supported providers and their configuration steps, see the Key management overview.

Key provider management

Key provider configuration or location may change. For example, a service is moved to a new address or the principal key must be moved to a different key provider type. pg_tde supports both these scenarios enabling you to manage principal keys using simple SQL functions.

In certain cases you can’t use SQL functions to manage key providers. For example, if the key provider changed while the server wasn’t running and is therefore unaware of these changes. The startup can fail if it needs to access the encryption keys.

For such situations, pg_tde also provides command line tools to recover the database.

Sensitive key provider information

Important

Authentication details for key providers are sensitive and must be protected. Do not store these credentials in the $PGDATA directory alongside the database. Instead, ensure they are stored in a secure location with strict file system permissions to prevent unauthorized access.

PG.CENTER edition · Upstream source

11 - Operations

Operational procedures for backup, restore, upgrades, enforcement, and multi-tenancy.

This is the Percona pg_tde 2.3.0 manual. For the paired build, backup tools and major upgrades, see PG TDE on Mimus.

PG.CENTER edition · Upstream source

11.1 - Encryption enforcement

Require new tables to use encryption at the server, database, role, or session level.

This is the Percona pg_tde 2.3.0 manual. For the paired build, backup tools and major upgrades, see PG TDE on Mimus.

For pg_tde, encryption enforcement ensures that only encrypted storage is allowed for specific operations, tables, or the entire database. It prevents the accidental creation of unencrypted tables or indexes in environments where encryption is required for compliance, security, or policy enforcement.

What does enforcement do?

When enabled, encryption enforcement:

  • Prevents creation of unencrypted tables or indexes
  • Enforces consistent encryption usage across tenants, databases, or users
  • Can be scoped globally, per database, or per role

Enforce encryption usage

Use the following techniques to enforce the secure use of pg_tde.

1. Enforce encryption across the server

To enforce encryption cluster-wide, set the pg_tde.enforce_encryption variable in postgresql.conf:

pg_tde.enforce_encryption = on
Note

Only superusers can set or change this variable.

This ensures that no user, including superusers, can create unencrypted tables. Superusers can however explicitly override the variable in their session.

2. Enforce encryption for a specific database

To apply encryption enforcement only within a specific database, run:

ALTER DATABASE example_db SET pg_tde.enforce_encryption = on;

This ensures encryption is enforced only when connected to that database.

3. Enforce encryption for a specific user

You can also enforce encryption on a per-user basis, run:

ALTER USER example_user SET pg_tde.enforce_encryption = on;

This ensures that the user example_user cannot create unencrypted tables, regardless of which database they connect to.

Override enforcement for trusted sessions

Superusers can override the variable at the session level:

SET pg_tde.enforce_encryption = off;

This allows temporary creation of unencrypted tables in special cases, such as:

  • Loading trusted, public reference datasets
  • Benchmarking and test environments
  • Migration staging before re-encryption
Note

While superusers can disable enforcement in their session, they must do so explicitly. Enforcement defaults remain active to protect from accidental misconfiguration.

PG.CENTER edition · Upstream source

11.2 - Configure multi-tenancy

Separate database keys and privileges for tenants sharing a PostgreSQL cluster.

This is the Percona pg_tde 2.3.0 manual. For the paired build, backup tools and major upgrades, see PG TDE on Mimus.

The steps below describe how to set up multi-tenancy with pg_tde. Multi-tenancy allows you to encrypt different databases with different keys. This provides granular control over data and enables you to introduce different security policies and access controls for each database so that only authorized users of specific databases have access to the data.

If you don’t need multi-tenancy, use the global key provider. See the configuration steps from the Configure pg_tde section.

For how to enable WAL encryption, refer to the Configure WAL Encryption section.

Considerations

You can use external key providers to manage encryption keys. The recommended approach is to use the Key Management Store (KMS). For more information, see Configure Key Management (KMS) .

Note

If no error is reported when running the commands below, the operation completed successfully.

Enable extension

Load the pg_tde at startup time. The extension requires additional shared memory; therefore, add the pg_tde value for the shared_preload_libraries parameter and restart the postgresql cluster.

  1. Use the ALTER SYSTEM command from psql terminal to modify the shared_preload_libraries parameter. This requires superuser privileges.

    ALTER SYSTEM SET shared_preload_libraries = 'pg_tde';
  2. Start or restart the postgresql cluster to apply the changes.

    • On Debian and Ubuntu:

      sudo systemctl restart postgresql-17
    • On RHEL and derivatives

      sudo systemctl restart postgresql-17
  3. Create the extension using the CREATE EXTENSION command. You must have the privileges of a superuser or a database owner to use this command. Connect to psql as a superuser for a database and run the following command:

    CREATE EXTENSION pg_tde;

    The pg_tde extension is created for the currently used database. To enable data encryption in other databases, you must explicitly run the CREATE EXTENSION command against them.

    Tip

    You can have the pg_tde extension automatically enabled for every newly created database. Modify the template template1 database as follows:

    psql -d template1 -c 'CREATE EXTENSION pg_tde;'

Key provider configuration

You must do these steps for every database where you have created the extension. For more information on configurations, please see the Configure Key Management (KMS) topic.

  1. Set up a key provider.

     **Warning:** This example is for testing purposes only:
    
     ```sql
     SELECT pg_tde_add_database_key_provider_file(
         'file-keyring', 
         '/tmp/pg_tde_test_local_keyring.per'
     );
     ```
    
  2. Create a key

    SELECT pg_tde_create_key_using_database_key_provider(
        'name-of-the-key', 
        'provider-name'
    );

    where:

    • name-of-the-key is the name of the principal key. You will use this name to identify the key.
    • provider-name is the name of the key provider you added before. The principal key is associated with this provider and it is the location where it is stored and fetched from.

    Warning: This example is for testing purposes only:

    SELECT pg_tde_create_key_using_database_key_provider(
        'test-db-master-key', 
        'file-vault'
    );
    Note

    The key is auto-generated.

  3. Use the key as principal key

    SELECT pg_tde_set_key_using_database_key_provider(
        'name-of-the-key', 
        'provider-name'
    );

    where:

    • name-of-the-key is the name of the principal key. You will use this name to identify the key.
    • provider-name is the name of the key provider you added before. The principal key will be associated with this provider.

    Warning: This example is for testing purposes only:

    SELECT pg_tde_set_key_using_database_key_provider(
        'test-db-master-key',
        'file-vault'
    );

PG.CENTER edition · Upstream source

11.3 - Backup with WAL encryption enabled

Back up an encrypted cluster and handle WAL with pgBackRest and pg_tde tools.

For Mimus, choose the backup client by WAL key history and use the client paired with the kernel. See the tested physical backup and restore sequence. Mimus procedure

Danger

Do not rotate encryption keys while a backup is running. This may result in an inconsistent backup and restore failure. This applies to all backup tools.

For more details, see Limitations of pg_tde.

To create a backup with WAL encryption enabled:

  1. Copy the pg_tde directory from the source server’s data directory, for example /var/lib/postgresql/data/pg_tde/, including the wal_keys and 1664_providers files, to the backup destination directory where pg_tde_basebackup will write the backup.

    Also copy any external files referenced by your providers configuration (such as certificate or key files) into the same relative paths under the backup destination, so that they are located and validated by pg_tde_basebackup -E.

  2. Run:

    pg_tde_basebackup -D /path/to/backup -E [aes_128|aes_256]

    Where:

    • -D /path/to/backup specifies the backup location where you have to copy pg_tde.
    • -E (or --encrypt-wal) enables WAL encryption and validates that the copied pg_tde and provider files are present and that the server key is accessible (required). The -E option accepts a cipher argument. The currently supported values are aes_128 and aes_256. If -E is not specified, pg_tde_basebackup attempts to determine the cipher from the server’s key. If no cipher can be determined, pg_tde_basebackup defaults to aes_128.
Note
  • The -E flag only works with the -X stream option (default). It is not compatible with -X none or -X fetch. For more information, see the backup method compatibility with WAL encryption.
  • The -E flag is only supported with the plain output format (-F p). It cannot be used with the tar output format (-F t).

Key rotation during backups

Danger

Do not rotate encryption keys while a backup is in progress. This applies to all backup tools.

Backups created during key rotation may fail to start during WAL replay and may lead to corruption of encrypted data (tables, indexes, and other relations).

For example, you may see errors such as:

FATAL: failed to retrieve principal key "database_keyXXXX" from key provider "providerYYYY"
CONTEXT: WAL redo at ... ROTATE_PRINCIPAL_KEY ...

To ensure standby recoverability, plan key rotations outside backup windows or take a new full backup after rotation completes.

Restore a backup created with WAL encryption

When you want to restore a backup created with pg_tde_basebackup -E:

  1. Ensure all external files referenced by your providers configuration (such as certificates or key files) are also present and accessible at the same relative paths.
  2. Start PostgreSQL with the restored data directory.

Backup method compatibility with WAL encryption

Tar format (-F t):

  • Works with -X fetch.
  • Does not support -X stream when WAL encryption is enabled. Using pg_tde_basebackup -F t -X stream will create a broken replica.

Streaming mode (-X stream):

  • Must specify -E (--encrypt-wal).
  • Without -E, backups may contain decrypted WAL while wal_encryption=on remains in postgresql.conf and pg_tde/wal_keys are copied. This leads to startup failures and compromised data in the backup.

Fetch mode (-X fetch):

  • Compatible with encrypted WAL without requiring any additional flags.

None (-X none):

  • Excludes WAL from the backup and is unaffected by WAL encryption.
Note

If the source server has pg_tde/wal_keys, running pg_tde_basebackup with -X none or -X fetch produces warnings such as:

pg_tde_basebackup: warning: the source has WAL keys, but no WAL encryption configured for the target backups
pg_tde_basebackup: detail: This may lead to exposed data and broken backup
pg_tde_basebackup: hint: Run pg_tde_basebackup with -E to encrypt streamed WAL

You can safely ignore the warnings with -X none or -X fetch, since no WAL streaming occurs.

PG.CENTER edition · Upstream source

11.4 - Restore encrypted backups

Restore encrypted data while retaining access to keys and required metadata.

For Mimus, restore the matching kernel, startup libraries, provider metadata and historical keys along with the backup. Mimus procedure

To restore an encrypted backup created with an earlier key, ensure the key is still available in your Key Management System (KMS). The backup remains encrypted on disk, pg_tde uses the correct key to transparently access the data.

How pg_tde uses old keys to load backups

  • KMS: stores the principal key(s) that were active when the backup was made.
  • Encrypted backup: contains data encrypted with the key available at that time.
  • Current server: pg_tde automatically loads the backup if the key is accessible through the KMS.

The table (internal) keys are stored within the backup. At runtime, pg_tde retrieves the principal key(s) from the configured KMS and uses them to decrypt the internal keys, enabling access to the encrypted table data.

Note

If the required key(s) get deleted or are missing, the backup cannot be read.

If the key(s) still exists but the KMS configuration has changed, you can use pg_tde_change_key_provider to update the configuration.

However, if the key(s) got deleted from all accessible KMS sources, the encrypted backup is unrecoverable.

PG.CENTER edition · Upstream source

11.5 - Upgrade pg_tde

Plan extension upgrades and major PostgreSQL upgrades for encrypted clusters.

Percona’s package upgrade steps apply to Percona PostgreSQL. For a major upgrade of a TDE-marked Mimus cluster use logical dump and restore.

The version of pg_tde available to you depends on your version of Percona Distribution for PostgreSQL.

To use a newer pg_tde release, first ensure that your Percona Distribution for PostgreSQL version includes it.

This document describes upgrading the pg_tde extension within the same PostgreSQL major version. For PostgreSQL major version upgrades on clusters that use pg_tde, use pg_tde_upgrade.

Before you start

Note

pg_tde 2.2.0 is not compatible with Percona Distribution for PostgreSQL older than 17.10 or 18.4. Upgrade your distribution first before upgrading pg_tde.

Warning

Using pg_upgrade on an encrypted cluster is not supported and will result in data corruption. The server may start successfully but queries against encrypted tables will fail.

Procedure

  1. Take a full backup before upgrading.

  2. Upgrade the pg_tde package via your package manager.

  3. Restart the postgresql service.

  4. Connect to each database where pg_tde is installed and run:

    ALTER EXTENSION pg_tde UPDATE;
    Note

    The catalog version of pg_tde may not change between patch releases. You can run ALTER EXTENSION pg_tde UPDATE safely regardless.

  5. Verify the upgrade:

SELECT extname, extversion FROM pg_extension WHERE extname = 'pg_tde';
SELECT pg_tde_version();

PG.CENTER edition · Upstream source

11.6 - Remove encryption from an encrypted table

Rewrite a tde_heap table with the standard heap access method.

This is the Percona pg_tde 2.3.0 manual. For the paired build, backup tools and major upgrades, see PG TDE on Mimus.

Method 1. Change the access method

If you encrypted a table with the tde_heap access method and need to remove the encryption from it, run the following command against the desired table (mytable in the example below):

ALTER TABLE mytable SET ACCESS METHOD heap;

Note that the SET ACCESS METHOD command drops hint bits and this may affect performance. Running a plain SELECT count(*) or VACUUM command on the entire table will check every tuple for visibility and set its hint bits. Therefore, after executing the ALTER TABLE command, run a simple count(*) on your tables:

SELECT count(*) FROM mytable;

Check that the table is not encrypted:

SELECT pg_tde_is_encrypted('mytable');

The output returns f meaning that the table is no longer encrypted.

Method 2. Create a new not encrypted table on the base of the encrypted one

Alternatively, you can create a new not encrypted table with the same structure and data as the initial table. For example, the original encrypted table is EncryptedCustomers. Use the following command to create a new table Customers:

CREATE TABLE Customers AS SELECT * FROM EncryptedCustomers;

The new table Customers inherits the structure and the data from EncryptedCustomers.

(Optional) If you no longer need the EncryptedCustomers table, you can delete it.

DROP TABLE EncryptedCustomers;

PG.CENTER edition · Upstream source

11.7 - Uninstall pg_tde

Remove encryption dependencies before uninstalling the extension and packages.

Mimus records TDE in the data directory. Retain the matching preload, tools and historical keys for recovery, including after dropping the SQL extension. To retire the dependency, migrate into a fresh cluster. Mimus procedure

If you no longer wish to use Transparent Data Encryption (TDE) in your deployment, you can remove the pg_tde extension.

To proceed, you must have one of the following privileges:

  • Superuser privileges (to remove the extension globally), or
  • Database owner privileges (to remove it from a specific database only)

To uninstall pg_tde, follow the steps below.

Step 1. Remove pg_tde from all databases

Before uninstalling, you must remove the extension from every database where it is loaded. If pg_tde was installed in templates, new databases inherit it. You must drop it from the templates first or future restores/creates will break.

a. Rewrite encrypted tables:

To rewrite an encrypted table back to its default storage method:

ALTER TABLE <table_name> SET ACCESS METHOD heap;

b. Remove the extension once all encrypted tables have been rewritten or dropped:

DROP EXTENSION pg_tde;
Note

If there are any encrypted objects that were not previously decrypted or deleted, this command will fail and you have to follow the steps above for these objects.

Repeat step 1 for every database in your cluster.

Step 2. Turn off WAL encryption

If you are using WAL encryption, you need to turn it off before you uninstall the pg_tde library:

a. Run:

ALTER SYSTEM SET pg_tde.wal_encrypt = off;

b. Restart the PostgreSQL cluster to apply the changes:

  • On Debian and Ubuntu:
sudo systemctl restart postgresql
  • On RHEL and derivatives:
sudo systemctl restart postgresql-(pg-version)

Step 3. Uninstall the pg_tde shared library

Warning

This process removes the extension, but does not decrypt data automatically. Only uninstall the shared library after all encrypted data has been removed or decrypted and WAL encryption has been disabled.

Note

Encrypted WAL pages will not be decrypted, so any postgres cluster needing to read them will need the pg_tde library loaded, and the WAL encryption keys available and in use.

At this point, the shared library is still loaded but no longer active. To fully uninstall pg_tde, complete the steps below.

a. Run SHOW shared_preload_libraries to view the current configuration of preloaded libraries.

For example:

postgres=# SHOW shared_preload_libraries;
        shared_preload_libraries
-----------------------------------------
pg_stat_statements,pg_tde,auto_explain
(1 row)

postgres=#

b. Remove pg_tde from the list and apply the new setting using ALTER SYSTEM SET shared_preload_libraries=<your list of libraries>.

For example:

postgres=# ALTER SYSTEM SET shared_preload_libraries=pg_stat_statements,auto_explain;
ALTER SYSTEM
postgres=#
Note

Your list of libraries will most likely be different than the above example. Take care not to remove other required extensions. Only delete pg_tde from the list.

If pg_tde is the only shared library in the list, and it was set via postgresql.conf you cannot disable it using the ALTER SYSTEM SET ... command. Instead:

  1. Remove the shared_preload_libraries line from postgresql.conf
  2. Run ALTER SYSTEM RESET shared_preload_libraries;

c. Restart the postgresql cluster to apply the changes:

  • On Debian and Ubuntu:

    sudo systemctl restart postgresql
  • On RHEL and derivatives:

    sudo systemctl restart postgresql-(pg-version)
    Note

    The service name may differ depending on your distribution and PostgreSQL version.nod

At this point it is safe to remove any configuration related to pg_tde from postgresql.conf and postgresql.auto.conf. Look for any configuration parameters prefixed with pg_tde. and remove or comment them out, as needed.

Troubleshooting: PANIC checkpoint not found on restart

This can happen if WAL encryption was not properly disabled before removing pg_tde from shared_preload_libraries, when the PostgreSQL server was not restarted after disabling WAL encryption (see step 3.c).

You might see this when restarting the PostgreSQL cluster:

2025-04-01 17:12:50.607 CEST [496385] PANIC:  could not locate a valid checkpoint record at 0/17B2580

This error means PostgreSQL is trying to read encrypted WAL without pg_tde loaded.

To resolve it follow these steps:

  1. Re-add pg_tde to shared_preload_libraries
  2. Restart the PostgreSQL cluster
  3. Follow the instructions for turning off WAL encryption before uninstalling the shared library again
Note

Two restarts are required to uninstall properly if WAL encryption was enabled:

  • First to disable WAL encryption
  • Second to remove the pg_tde library

PG.CENTER edition · Upstream source

12 - Configure WAL encryption

Create and assign the server principal key, then enable encrypted WAL writes.

This is the Percona pg_tde 2.3.0 manual. For the paired build, backup tools and major upgrades, see PG TDE on Mimus.

WAL encryption requires a principal key. You can satisfy this requirement in one of the following ways:

WAL archiving and recovery requirements

A deployment with WAL encryption is not supported unless you use both of the following tools for WAL archiving and recovery:

If you use pgBackRest, you must also disable its asynchronous archiving, WAL header checks, and page checksum validation. Add these settings to the applicable pgBackRest configuration section:

archive-async=n
archive-header-check=n
checksum-page=n

Option 1: Use the default principal key

If a default principal key is already configured for the server, WAL encryption uses it automatically. No additional server key configuration is required.

If you have not yet configured a default principal key, see Default Principal Key configuration.

Option 2: Configure a dedicated server principal key for WAL

Note

For a comprehensive list of supported pg_tde WAL encryption tools see Limitations of pg_tde.

  1. Create the pg_tde extension if it does not exist:

    CREATE EXTENSION IF NOT EXISTS pg_tde;
  2. Configure a global key provider

    Before creating the server (principal) key for WAL encryption, you must first configure a global key provider. See Key management overview for detailed instructions on configuring supported key providers.

  3. Create the server (principal) key using the global key provider

    The server key (also referred to as the principal key) is the key used by PostgreSQL to encrypt WAL data. See pg_tde_create_key_using_global_key_provider for more detailed instructions.

  4. Set the server (principal) key

    This step sets the previously created server (principal) key as the active key used by PostgreSQL for WAL encryption. See pg_tde_set_server_key_using_global_key_provider for more detailed instructions.

  5. Enable WAL encryption using the ALTER SYSTEM command. You need the privileges of the superuser to run this command:

    ALTER SYSTEM SET pg_tde.wal_encrypt = on;
  6. Restart the server to apply the changes.

    • On Debian and Ubuntu:
    sudo systemctl restart postgresql
    • On RHEL and derivatives
    sudo systemctl restart postgresql-<version>
  7. (Optional) Verify that WAL encryption is enabled:

    SHOW pg_tde.wal_encrypt;

Now WAL files start to be encrypted for both encrypted and unencrypted tables.

For more technical references related to architecture, variables or functions, see: Technical Reference

💬 Need help customizing this for your infrastructure? Contact Percona support

PG.CENTER edition · Upstream source

13 - Streaming replication with tde_heap

Prepare keys, roles, and encrypted base backups for a physical streaming replica.

This is the Percona pg_tde 2.3.0 manual. For the paired build, backup tools and major upgrades, see PG TDE on Mimus.

Editorial correction

Creating a key and assigning the server key are separate operations. See site errata.

This section outlines how to set up PostgreSQL streaming replication when the pg_tde extension, specifically the tde_heap access method, is enabled on the primary server.

Before you begin, ensure you have followed the pg_tde setup instructions.

Note

You do not need to run CREATE EXTENSION on the standby. It will be replicated automatically.

1. Configure the Primary

Create a principal key

First create a key on the configured global provider using pg_tde_create_key_using_global_key_provider. Then assign it as the server key with pg_tde_set_server_key_using_global_key_provider.

Create the replication role

Create a replication role on the primary:

CREATE ROLE example_replicator WITH REPLICATION LOGIN PASSWORD 'example_password';

Configure pg_hba.conf

To allow the replica to connect to the primary server, add the following line in pg_hba.conf:

host  replication  example_replicator  standby_ip/32  scram-sha-256

Ensure that it is placed before the other host rules for replication and then reload the configuration:

SELECT pg_reload_conf();

2. Configure the Standby

Perform a database backup

Run the base backup from your standby machine to pull the encrypted base backup:

export PGPASSWORD='example_password'
pg_tde_basebackup \
  -h primary_ip \
  -D /var/lib/pgsql/data \
  -U example_replicator \
  --wal-method=stream \
  --slot=tde_slot \
  -C \
  -c fast \
  -v -P

Configure postgresql.conf

After the base backup completes, add the following line to the standby’s postgresql.conf file:

shared_preload_libraries = 'pg_tde'

3. Start and validate replication

Assuming that the primary and the standby are running on separate hosts, start the PostgreSQL service:

sudo systemctl start postgresql
Key management consistency required for replication

If you’re using a KMS provider, such as Vault or KMIP, make sure that both the primary and the standby have access to the same key management configuration, and that the paths to the configuration files are identical on both systems.

For example:

  • If you configure Vault with a secret path: /path/to/secret.file, then that file must exist at the same path on both the primary and the standby.
  • If you use the keyring_file provider, be aware that it stores key material in a local file and it is not designed for shared or concurrent use across multiple servers. It is not recommended in replication setups.
  • On primary:
SELECT client_addr, state FROM pg_stat_replication;
  • On standby:
SELECT
    pg_is_in_recovery()          AS in_recovery,
    pg_last_wal_receive_lsn()    AS receive_lsn,
    pg_last_wal_replay_lsn()     AS replay_lsn;
Tip

Want to verify that everything is working? After creating an encrypted table on the primary, run the following command on the standby to confirm that the encryption is active and the keys are resolved:

SELECT pg_tde_is_encrypted('your_encrypted_table');

PG.CENTER edition · Upstream source

14 - Technical reference

Architecture, usage reference, GUC variables, functions, and replication details.

This is the Percona pg_tde 2.3.0 manual. For the paired build, backup tools and major upgrades, see PG TDE on Mimus.

PG.CENTER edition · Upstream source

14.1 - Technical reference overview

Find the architecture, configuration, SQL, and replication reference pages.

This is the Percona pg_tde 2.3.0 manual. For the paired build, backup tools and major upgrades, see PG TDE on Mimus.

This section covers the internal components and tools that power pg_tde.

Use it to understand how encryption is implemented, fine-tune a configuration, leverage advanced CLI tools and functions for diagnostics and customization.

Usage reference

A description of the main pg_tde operations available, including configuring key providers, managing principal keys, setting permissions, and encrypting tables.

Follow the usage guide

Functions

Use built-in functions to manage key providers, create and rotate principal keys, and verify encryption status. Includes commands for Vault, KMIP, and local providers, plus utilities to inspect or validate keys.

Browse available functions →

GUC Variables

Configure how pg_tde behaves with PostgreSQL. Control WAL encryption, enforce encryption for new tables, and manage global provider inheritance. Includes scope levels, defaults, and permission requirements.

Configure GUC variables

Streaming replication

Learn how to configure PostgreSQL streaming replication with pg_tde using the tde_heap access method. Covers primary and standby setup, key management requirements, and validation steps.

Set up replication with tde_heap

PG.CENTER edition · Upstream source

14.2 - Usage reference

Understand provider namespaces, key scopes, permissions, and operational changes.

This is the Percona pg_tde 2.3.0 manual. For the paired build, backup tools and major upgrades, see PG TDE on Mimus.

Editorial correction

Obsolete GUC names and invalid server/default function variants are corrected against the pinned source code. See site errata.

This chapter describes the main pg_tde operations available, including configuring key providers, managing principal keys, setting permissions, and encrypting tables.

Use this chapter as a reference when performing specific pg_tde tasks.

Prerequisites

Before using pg_tde, complete the setup steps as described in Install pg_tde.

Add providers

You can add key providers to either the global or database specific scope.

If pg_tde.inherit_global_providers is on, global providers are visible for all databases, and can be used. If pg_tde.inherit_global_providers is off, global providers are only used for WAL encryption.

To add a global provider:

pg_tde_add_global_key_provider_<TYPE>('provider_name', ... details ...)

To add a database specific provider:

pg_tde_add_database_key_provider_<TYPE>('provider_name', ... details ...)

Change providers

To change a value of a global provider:

pg_tde_change_global_key_provider_<TYPE>('provider_name', ... details ...)

To change a value of a database specific provider:

pg_tde_change_database_key_provider_<TYPE>('provider_name', ... details ...)

These functions also allow changing the type of a provider but do not migrate any data. They are expected to be used during infrastructure migration, for example when the address of a server changes.

Change providers from the command line

To change a provider from a command line, pg_tde provides the pg_tde_change_key_provider command line tool.

This tool works similarly to the above functions, with the following syntax:

pg_tde_change_key_provider <dbOid> <providerType> ... details ...
Note

Since this tool is intended to be run while the PostgreSQL server is stopped, it bypasses all permission checks. For this reason, it requires a database OID (dbOid) instead of a database name, as it cannot access the system catalogs.

This tool does not validate any parameters.

Delete providers

Providers can be deleted by using the following functions:

pg_tde_delete_database_key_provider(provider_name)
pg_tde_delete_global_key_provider(provider_name)

For database specific providers, the function first checks if the provider is used or not, and the provider is only deleted if it’s not used.

For global providers, the function checks if the provider is used anywhere, WAL or any specific database, and returns an error if it is.

List/query providers

pg_tde provides 2 functions to show providers:

  • pg_tde_list_all_database_key_providers()
  • pg_tde_list_all_global_key_providers()

These functions return a list of provider names, type and configuration.

Provider permissions

pg_tde implements access control based on execution rights on the administration functions.

For keys and providers administration, it provides two functions:

pg_tde_GRANT_database_key_management_TO_role(role_name)
pg_tde_REVOKE_database_key_management_FROM_role(role_name)

These functions take a role name as a string argument, for example 'user1'.

Create and rotate keys

Principal keys can be created using the following functions:

pg_tde_create_key_using_(global/database)_key_provider('key-name', 'provider-name')

Principal keys can be used or rotated using the following functions:

pg_tde_set_key_using_(global/database)_key_provider('key-name', 'provider-name')
pg_tde_set_server_key_using_global_key_provider('key-name', 'provider-name')
pg_tde_set_default_key_using_global_key_provider('key-name', 'provider-name')

Default principal key

With pg_tde.inherit_global_providers, it is also possible to set up a default global principal key, which will be used by any database which has the pg_tde extension enabled, but doesn’t have a database specific principal key configured using pg_tde_set_key_using_(global/database)_key_provider.

With this feature, it is possible for the entire database server to easily use the same principal key for all databases, completely disabling multi-tenancy.

Manage a default key

You can manage a default key with the following functions:

  • pg_tde_create_key_using_global_key_provider('key-name','provider-name')
  • pg_tde_set_default_key_using_global_key_provider('key-name','provider-name')
  • pg_tde_delete_default_key()
Note

pg_tde_delete_default_key() is only possible if there’s no database currently using the default principal key. Changing the default principal key will rotate the encryption of internal keys for all databases using the current default principal key.

Delete a key

The pg_tde_delete_key() function unsets the principal key for the current database. If the current database has any encrypted tables, and there isn’t a default principal key configured, it reports an error instead. If there are encrypted tables, but there’s also a default principal key, internal keys will be encrypted with the default key.

Note

WAL keys cannot be unset, as server keys are managed separately.

Current key details

pg_tde_key_info() returns the name of the current principal key, and the provider it uses.

pg_tde_server_key_info() does the same for the server key.

pg_tde_default_key_info() does the same for the default key.

pg_tde_verify_key() checks that the key provider is accessible, that the current principal key can be downloaded from it, and that it is the same as the current key stored in memory - if any of these fail, it reports an appropriate error.

Key permissions

Users with management permissions to a specific database (pg_tde_(grant/revoke)_(global/database)_key_management_(to/from)_role) can change the keys for the database, and use the current key functions. This includes creating keys using global providers, if pg_tde.inherit_global_providers is enabled.

Also the pg_tde_(grant/revoke)_database_key_management_to_role function deals with only the specific permission for the above function: it allows a user to change the key for the database, but not to modify the provider configuration.

Create an encrypted table

To create an encrypted table, use the following command:

CREATE TABLE t1(a INT) USING tde_heap;

Alter an encrypted table

To alter or modify an encrypted table, use the following command:

ALTER TABLE t1;

Change the pg_tde.inherit_global_providers setting

It is possible to use pg_tde with pg_tde.inherit_global_providers = on, refer to the global keys or keyrings in databases, and then change this setting to off.

In this case, existing references to global providers or the global default principal key keep working as before, but new references to the global scope cannot be made.

PG.CENTER edition · Upstream source

15 - GUC Variables

Reference for WAL encryption, enforcement, global providers, and cipher selection.

This is the Percona pg_tde 2.3.0 manual. For the paired build, backup tools and major upgrades, see PG TDE on Mimus.

The pg_tde extension provides GUC variables to configure the behaviour of the extension:

pg_tde.wal_encrypt

Type - boolean
Default - off

A boolean variable that controls if WAL writes are encrypted or not.

Changing this variable requires a server restart, and can only be set at the server level.

WAL encryption is controlled globally. If enabled, all WAL writes are encrypted in the entire PostgreSQL cluster.

This variable only controls new writes to the WAL, it doesn’t affect existing WAL records.

pg_tde is always capable of reading existing encrypted WAL records, as long as the keys used for the encryption are still available.

Enabling WAL encryption requires a configured global principal key. Refer to the WAL encryption configuration topic for more information.

pg_tde.enforce_encryption

Type - boolean
Default - off

A boolean variable that controls if the creation of new, not encrypted tables is allowed.

If enabled, CREATE TABLE statements will fail unless they use the tde_heap access method.

Similarly, ALTER TABLE <x> SET ACCESS METHOD is only allowed, if the access method is tde_heap.

Other DDL operations are still allowed. For example other ALTER commands are allowed on unencrypted tables, as long as the access method isn’t changed.

You can set this variable at the following levels:

  • global - for the entire PostgreSQL cluster
  • database - for specific databases
  • user - for specific users
  • session - for the current session

Setting or changing the value requires superuser permissions. For examples, see the Encryption Enforcement topic.

pg_tde.inherit_global_providers

Type - boolean
Default - on

A boolean variable that controls if databases can use global key providers for storing principal keys.

If disabled, functions that change the key providers can only work with database local key providers.

In this case, the default principal key, if set, is also disabled.

You can set this variable at the following levels:

  • global - for the entire PostgreSQL cluster
  • database - for specific databases
  • user - for specific users
  • session - for the current session
Note

Setting this variable doesn’t affect existing uses of global keys. It only prevents the creation of new principal keys using global providers.

pg_tde.cipher

Type - string
Default - aes_128

A string variable that selects the cipher (encryption algorithm). Currently, the supported values are aes_128 and aes_256, corresponding to AES 128-bit and 256-bit key lengths, respectively.

The setting applies only to objects created after the value is set, including principal keys, internal keys, and data encrypted by those keys. Existing objects are not re-encrypted.

PG.CENTER edition · Upstream source

16 - Functions

SQL reference for providers, principal keys, privileges, and encryption status.

This is the Percona pg_tde 2.3.0 manual. For the paired build, backup tools and major upgrades, see PG TDE on Mimus.

Editorial correction

Parameter names and key scopes are corrected against the pinned source code. See site errata.

The pg_tde extension provides functions for managing different aspects of its operation:

Note

If no error is reported when running the commands below, the operation completed successfully.

Key provider management

A key provider is a system or service responsible for managing encryption keys. For more information on the key providers pg_tde supports see the Key management overview.

Key provider management includes the following operations:

Add a key provider

You can add a new key provider using the provided functions, which are implemented for each provider type.

There are two functions to add a key provider: one function adds it for the current database and another one - for the global scope.

  • pg_tde_add_database_key_provider_<type>('provider-name', <provider specific parameters>)
  • pg_tde_add_global_key_provider_<type>('provider-name', <provider specific parameters>)

When you add a new provider, the provider name must be unique in the scope. But a local database provider and a global provider can have the same name.

Change an existing provider

You can change an existing key provider using the provided functions, which are implemented for each provider type.

There are two functions to change existing providers: one to change a provider in the current database, and another one to change a provider in the global scope.

  • pg_tde_change_database_key_provider_<type>('provider-name', <provider specific parameters>)
  • pg_tde_change_global_key_provider_<type>('provider-name', <provider specific parameters>)

When you change a provider, the referred name must exist in the database local or a global scope.

The change functions require the same parameters as the add functions. They overwrite the setting for every parameter except for the name, which can’t be changed.

Provider specific parameters differ for each implementation. Refer to the respective subsection for details.

Note

The updated provider must be able to retrieve the same principal keys as the original configuration. If the new configuration cannot access existing keys, encrypted data and backups will become unreadable.

Add or modify Vault providers

The Vault provider connects to a HashiCorp Vault or an OpenBao server, and stores the keys on a key-value store version 2.

Use the following functions to add the Vault provider:

SELECT pg_tde_add_database_key_provider_vault_v2(
  'provider-name',
  'url',
  'mount',
  'secret_token_path',
  'ca_path'
);

SELECT pg_tde_add_global_key_provider_vault_v2(
  'provider-name',
  'url',
  'mount',
  'secret_token_path',
  'ca_path'
);

SELECT pg_tde_add_database_key_provider_vault_v2(
  'provider-name',
  'url',
  'mount',
  'secret_token_path',
  'ca_path',
  'namespace'
);

SELECT pg_tde_add_global_key_provider_vault_v2(
  'provider-name',
  'url',
  'mount',
  'secret_token_path',
  'ca_path',
  'namespace'
);

These functions change the Vault provider:

SELECT pg_tde_change_database_key_provider_vault_v2(
  'provider-name',
  'url',
  'mount',
  'secret_token_path',
  'ca_path'
);

SELECT pg_tde_change_global_key_provider_vault_v2(
  'provider-name',
  'url',
  'mount',
  'secret_token_path',
  'ca_path'
);
SELECT pg_tde_change_database_key_provider_vault_v2(
  'provider-name',
  'url',
  'mount',
  'secret_token_path',
  'ca_path',
  'namespace'
);

SELECT pg_tde_change_global_key_provider_vault_v2(
  'provider-name',
  'url',
  'mount',
  'secret_token_path',
  'ca_path',
  'namespace'
);

where:

  • provider-name is the name of the key provider
  • url is the URL of the Vault server
  • mount is the mount point on the Vault server where the key provider should store the keys
  • secret_token_path is a path to the file that contains an access token with read and write access to the above mount point
  • [optional] ca_path is the path of the CA file used for SSL verification
  • [namespace] namespace is the path of the namespace when using Vault with namespaes

Add or modify KMIP providers

The KMIP provider uses a remote KMIP server.

Use these functions to add a KMIP provider:

SELECT pg_tde_add_database_key_provider_kmip(
  'provider-name',
  'kmip-addr',
  port,
  '/path_to/client_cert.pem',
  '/path_to/client_key.pem',
  '/path_to/server_certificate.pem'
);

SELECT pg_tde_add_global_key_provider_kmip(
  'provider-name',
  'kmip-addr',
  port,
  '/path_to/client_certificate.pem',
  '/path_to/client_key.pem',
  '/path_to/server_certificate.pem'
);

These functions change the KMIP provider:

SELECT pg_tde_change_database_key_provider_kmip(
  'provider-name',
  'kmip-addr',
  port,
  '/path_to/client_cert.pem',
  '/path_to/client_key.pem',
  '/path_to/server_certificate.pem'
);

SELECT pg_tde_change_global_key_provider_kmip(
  'provider-name',
  'kmip-addr',
  port,
  '/path_to/client_certificate.pem',
  '/path_to/client_key.pem',
  '/path_to/server_certificate.pem'
);

where:

  • provider-name is the name of the provider
  • kmip-addr is the IP address or domain name of the KMIP server
  • port is the port to communicate with the KMIP server. Most KMIP servers use port 5696.
  • server-certificate is the path to the certificate file for the KMIP server.
  • client-certificate is the path to the client certificate.
  • client-key is the path to the client key.
Note

The specified access parameters require permission to read and write keys at the server.

Add or modify local key file providers

This provider manages database keys using a local key file.

This function is intended for development or quick testing, and stores the keys unencrypted in the specified data file.

Important

Local key file providers are not recommended for production environments, they lack the security and manageability of external key management systems.

Add a local key file provider:

SELECT pg_tde_add_database_key_provider_file(
  'provider-name',
  '/path/to/the/key/provider/data.file'
);

SELECT pg_tde_add_global_key_provider_file(
  'provider-name',
  '/path/to/the/key/provider/data.file'
);

Change a local key file provider:

SELECT pg_tde_change_database_key_provider_file(
  'provider-name',
  '/path/to/the/key/provider/data.file'
);

SELECT pg_tde_change_global_key_provider_file(
  'provider-name',
  '/path/to/the/key/provider/data.file'
);

where:

  • provider-name is the name of the provider. You can specify any name, it’s for you to identify the provider.
  • /path/to/the/key/provider/data.file is the path to the key provider file.

Delete a provider

These functions delete an existing provider in the current database or in the global scope:

  • pg_tde_delete_database_key_provider('provider-name')
  • pg_tde_delete_global_key_provider('provider-name')

You can only delete key providers that are not currently in use. An error is returned if the current principal key is using the provider you are trying to delete.

If the use of global key providers is enabled via the pg_tde.inherit_global_providers GUC, you can delete a global key provider only if it isn’t used anywhere, including any databases. If it is used in any database, an error is returned instead.

List key providers

These functions list the details of all key providers for the current database or for the global scope, including all configuration values:

  • pg_tde_list_all_database_key_providers()
  • pg_tde_list_all_global_key_providers()

Principal key management

Use these functions to create a new principal key at a given keyprover, and to use those keys for a specific scope such as a current database, a global or default scope. You can also use them to start using a different existing key for a specific scope.

Principal keys are stored on key providers by the name specified in this function - for example, when using the Vault provider, after creating a key named “foo”, a key named “foo” will be visible on the Vault server at the specified mount point.

pg_tde_create_key_using_database_key_provider

Creates a principal key using the database-local key provider with the specified name. Use this key later with pg_tde_set_key_using_database_key_provider().

SELECT pg_tde_create_key_using_database_key_provider(
  'key-name',
  'provider-name'
);

pg_tde_create_key_using_global_key_provider

Creates a principal key at a global key provider with the given name. Use this key later with the pg_tde_set_* series of functions.

SELECT pg_tde_create_key_using_global_key_provider(
  'key-name',
  'provider-name'
);

pg_tde_set_key_using_database_key_provider

Sets the principal key for the current database, using the specified local key provider. It also rotates internal encryption keys to use the specified principal key.

This function is typically used when working with per-database encryption through a local key provider.

SELECT pg_tde_set_key_using_database_key_provider(
  'key-name',
  'provider-name'
);

pg_tde_set_key_using_global_key_provider

Sets or rotates the principal key for the current database, using the specified global key provider. For WAL encryption, use pg_tde_set_server_key_using_global_key_provider.

SELECT pg_tde_set_key_using_global_key_provider(
  'key-name',
  'provider-name'
);

pg_tde_set_server_key_using_global_key_provider

Sets or rotates the server principal key using the specified global key provider. Use this function to set a principal key for WAL encryption.

SELECT pg_tde_set_server_key_using_global_key_provider(
  'key-name',
  'provider-name'
);

pg_tde_set_default_key_using_global_key_provider

Sets or rotates the default principal key for the server using the specified global key provider.

The default key is automatically used as a principal key by any database that doesn’t have an individual key provider and key configuration.

SELECT pg_tde_set_default_key_using_global_key_provider(
  'key-name',
  'provider-name'
);

pg_tde_delete_key

Unsets the principal key for the current database. If the current database has any encrypted tables, and there isn’t a default principal key configured, it reports an error instead. If there are encrypted tables, but there’s also a default principal key, internal keys will be encrypted with the default key.

SELECT pg_tde_delete_key();

pg_tde_delete_default_key

Unsets default principal key. It’s possible only if no database uses default principal key.

SELECT pg_tde_delete_default_key();

Encryption status check

pg_tde_is_encrypted

Tells if a relation is encrypted using the pg_tde extension or not. Returns NULL if a relation lacks storage like views, foreign tables, and partitioned tables and indexes.

To verify that a table is encrypted, run the following statement:

SELECT pg_tde_is_encrypted(
  'table_name'
);

You can also verify if the table in a custom schema is encrypted. Pass the schema name for the function as follows:

SELECT pg_tde_is_encrypted(
  'schema.table_name'
);

This can additionally be used to verify that indexes and sequences are encrypted.

pg_tde_key_info

Displays information about the principal key for the current database, if it exists.

SELECT pg_tde_key_info();

pg_tde_server_key_info

Displays information about the principal key for the server scope, if exists.

SELECT pg_tde_server_key_info();

pg_tde_default_key_info

Displays the information about the default principal key, if it exists.

SELECT pg_tde_default_key_info();

pg_tde_verify_key

This function checks that the current database has a properly functional encryption setup, which means:

  • A key provider is configured
  • The key provider is accessible using the specified configuration
  • There is a principal key for the database
  • The principal key can be retrieved from the remote key provider
  • The principal key returned from the key provider is the same as cached in the server memory

If any of the above checks fail, the function reports an error.

SELECT pg_tde_verify_key();

pg_tde_verify_server_key

This function checks that the server scope has a properly functional encryption setup, which means:

  • A key provider is configured
  • The key provider is accessible using the specified configuration
  • There is a principal key for the global scope
  • The principal key can be retrieved from the remote key provider
  • The principal key returned from the key provider is the same as cached in the server memory

If any of the above checks fail, the function reports an error.

SELECT pg_tde_verify_server_key();

pg_tde_verify_default_key

This function checks that the default key is properly configured, which means:

  • A key provider is configured
  • The key provider is accessible using the specified configuration
  • There is a principal key that can be used for any scope
  • The principal key can be retrieved from the remote key provider
  • The principal key returned from the key provider is the same as cached in the server memory

If any of the above checks fail, the function reports an error.

SELECT pg_tde_verify_default_key();

PG.CENTER edition · Upstream source

17 - Command-line tools

Reference pages for the pg_tde utilities used with encrypted data and WAL.

This is the Percona pg_tde 2.3.0 manual. For the paired build, backup tools and major upgrades, see PG TDE on Mimus.

PG.CENTER edition · Upstream source

17.1 - Overview of pg_tde CLI tools

Choose the pg_tde-aware utilities required for encrypted data and WAL.

This is the Percona pg_tde 2.3.0 manual. For the paired build, backup tools and major upgrades, see PG TDE on Mimus.

The pg_tde extension provides a set of command-line utilities designed specifically for operating on encrypted data and clusters. These utilities exist in parallel with the standard PostgreSQL utilities but you must use them when working with data encrypted by pg_tde.

Note

The standard PostgreSQL tools cannot operate on pg_tde-encrypted WAL or tables.

New pg_tde specific tools

These tools are introduced exclusively by pg_tde to support key rotation and WAL encryption workflows:

Tools for working with pg_tde-encrypted data

These tools are modified versions of standard PostgreSQL utilities that include pg_tde support. You must use the pg_tde_* variants when working with encrypted WAL or tables:

  • pg_tde_checksums: verify data checksums
  • pg_tde_waldump: inspect and decrypt WAL files
  • pg_tde_basebackup: create base backups that include encrypted data
  • pg_tde_resetwal: reset the WAL for clusters using pg_tde
  • pg_tde_rewind: rewind clusters that use encrypted WAL
  • pg_tde_upgrade: perform major version upgrades of clusters with pg_tde

PG.CENTER edition · Upstream source

17.2 - pg_tde_archive_decrypt

Decrypt WAL while wrapping an archive command for tools that require plaintext WAL.

This is the Percona pg_tde 2.3.0 manual. For the paired build, backup tools and major upgrades, see PG TDE on Mimus.

The pg_tde_archive_decrypt tool wraps an archive command and decrypts WAL files before archiving. It allows external tools to access unencrypted WAL data, which is required because WAL encryption keys in the two-key hierarchy are host-specific and may not be available on the replay host.

Tip

For more information on the encryption architecture and key hierarchy, see Architecture.

This tool is often used in conjunction with pg_tde_restore_encrypt to support WAL archive.

How it works

  1. Decrypts the WAL segment to a temporary file on a RAM disk (/dev/shm)
  2. Replaces %p and %f in the archive command with the path and name of the decrypted file
  3. Executes the archive command
Note

To ensure security, encrypt the files stored in your WAL archive using tools like PgBackRest.

Usage

pg_tde_archive_decrypt [OPTION]
pg_tde_archive_decrypt DEST-NAME SOURCE-PATH ARCHIVE-COMMAND

Parameter descriptions

  • DEST-NAME: name of the WAL file to send to the archive
  • SOURCE-PATH: path to the original encrypted WAL file
  • ARCHIVE-COMMAND: archive command to wrap. %p and %f are replaced with the decrypted WAL file path and WAL file name, respectively.

Options

  • -V, --version: show version information, then exit
  • -?, --help: show help information, then exit
Note

Any %f or %p parameter in ARCHIVE-COMMAND has to be escaped as %%f or %%p respectively if used as archive_command in postgresql.conf.

Examples

Using cp

archive_command='pg_tde_archive_decrypt %f %p "cp %%p /mnt/server/archivedir/%%f"'

Using PgBackRest

archive_command='pg_tde_archive_decrypt %f %p "pgbackrest --stanza=your_stanza archive-push %%p"'
Required configuration

A deployment with WAL encryption is not supported unless archive_command uses pg_tde_archive_decrypt and restore_command uses pg_tde_restore_encrypt.

Disable the following pgBackRest features in the applicable pgBackRest configuration section:

archive-async=n
archive-header-check=n
checksum-page=n

PG.CENTER edition · Upstream source

17.3 - pg_tde_restore_encrypt

Wrap a restore command and encrypt the retrieved WAL before PostgreSQL reads it.

This is the Percona pg_tde 2.3.0 manual. For the paired build, backup tools and major upgrades, see PG TDE on Mimus.

Editorial correction

The placeholder descriptions now match the tool’s built-in help. See site errata.

The pg_tde_restore_encrypt tool wraps a normal restore command from the WAL archive and writes them to disk in a format compatible with pg_tde.

Note

This command is often use together with pg_tde_archive_decrypt.

How it works

  1. Replaces %f and %p in the restore command with the WAL file name and temporary file path (in /dev/shm)
  2. Runs the restore command to fetch the unencrypted WAL from the archive and write it to the temp file
  3. Encrypts the temp file and writes it to the destination path in PostgreSQL’s data directory

Usage

pg_tde_restore_encrypt [OPTION]
pg_tde_restore_encrypt SOURCE-NAME DEST-PATH RESTORE-COMMAND

Parameter descriptions

  • SOURCE-NAME: name of the WAL file to retrieve from the archive
  • DEST-PATH: path where the encrypted WAL file should be written
  • RESTORE-COMMAND: restore command to wrap; %f and %p are replaced with the WAL file name and path to write the unencrypted WAL, respectively

Options

  • -V, --version: show version information, then exit
  • -?, --help: show help information, then exit
Note

Any %f or %p parameter in RESTORE-COMMAND has to be escaped as %%f or %%p respectively if used as restore_command in postgresql.conf.

Examples

Using cp

restore_command='pg_tde_restore_encrypt %f %p "cp /mnt/server/archivedir/%%f %%p"'

Using PgBackRest

restore_command='pg_tde_restore_encrypt %f %p "pgbackrest --stanza=your_stanza archive-get %%f \"%%p\""'
Required configuration

A deployment with WAL encryption is not supported unless archive_command uses pg_tde_archive_decrypt and restore_command uses pg_tde_restore_encrypt.

Disable the following pgBackRest features in the applicable pgBackRest configuration section:

archive-async=n
archive-header-check=n
checksum-page=n

PG.CENTER edition · Upstream source

17.4 - pg_tde_change_key_provider

Change provider configuration in an offline data directory.

This is the Percona pg_tde 2.3.0 manual. For the paired build, backup tools and major upgrades, see PG TDE on Mimus.

A tool for modifying the configuration of a key provider, possibly also changing its type.

This tool edits the configuration files directly, ignoring permissions or running postgres processes.

Its only intended use is to fix servers that can’t start up because of inaccessible key providers.

For example, you restore from an old backup and the address of the key provider changed in the meantime. You can use this tool to correct the configuration, allowing the server to start up.

Warning: Use this tool only when the server is offline. To modify the key provider configuration when the server is up and running, use the pg_tde_change_(global/database)_key_provider_<type> SQL functions.

Example usage

To modify the key provider configuration, specify all parameters depending on the provider type in the same way as you do when using the pg_tde_change_(global/database)_key_provider_<type> SQL functions.

The general syntax is as follows:

pg_tde_change_key_provider [-D <datadir>] <dbOid> <provider_name> <new_provider_type> <provider_parameters...>

Parameter description

  • [optional] <datadir> is the data directory.pg_tde uses the $PGDATA environment variable if this is not specified
  • <provider_name> is the name you assigned to the key provider
  • <new_provider_type> can be a file, vault or kmip
  • <dbOid>

Depending on the provider type, the additional parameters are:

pg_tde_change_key_provider [-D <datadir>] <dbOid> <provider_name> file <filename>
pg_tde_change_key_provider [-D <datadir>] <dbOid> <provider_name> vault-v2 <url> <mount_path> <token_path> [<ca_path>]
pg_tde_change_key_provider [-D <datadir>] <dbOid> <provider_name> kmip <host> <port> <cert_path> <key_path> [<ca_path>] 

PG.CENTER edition · Upstream source

17.5 - pg_tde_checksums

Check or change checksums with pg_tde support on PostgreSQL 17 and later.

This is the Percona pg_tde 2.3.0 manual. For the paired build, backup tools and major upgrades, see PG TDE on Mimus.

pg_tde_checksums is a PostgreSQL command-line utility used to enable, disable, or verify data checksums on a PostgreSQL data directory. The tool is modified to add support for working with encrypted tables.

PG.CENTER edition · Upstream source

17.6 - pg_tde_waldump

Inspect encrypted WAL with a pg_tde-aware version of pg_waldump.

This is the Percona pg_tde 2.3.0 manual. For the paired build, backup tools and major upgrades, see PG TDE on Mimus.

pg_tde_waldump displays a human-readable rendering of the Write-Ahead Log (WAL) for a PostgreSQL database cluster.

To read encrypted WAL records, pg_tde_waldump provides the following additional option:

  • -k, --keyring-path=PATH is the path to the directory containing the WAL keyring configuration files. This is typically the pg_tde/ directory inside the PostgreSQL data directory. The following files are included:
    • wal_keys
    • 1664_providers
Note

pg_tde_waldump cannot read encrypted WAL unless --keyring-path is specified.

Since pg_tde 2.3.0, pg_tde_waldump recognizes the pg_tde custom resource manager, prints its WAL records correctly, and accepts it in the --rmgr filter.

PG.CENTER edition · Upstream source

17.7 - pg_tde_upgrade

Upgrade PostgreSQL data directories that contain pg_tde-encrypted relations.

This physical upgrade procedure applies to Percona PostgreSQL. For a major upgrade of a TDE-marked Mimus cluster, use logical dump and restore into a new cluster. Mimus procedure

pg_tde_upgrade is the supported method for performing PostgreSQL major version upgrades on clusters that use pg_tde.

Use this tool instead of pg_upgrade whenever the cluster uses pg_tde, including clusters with encrypted tables or encrypted WAL.

pg_tde_upgrade wraps pg_upgrade to simplify upgrading clusters with encrypted relations or WAL. It can also be run safely on clusters without pg_tde enabled.

When to use which upgrade procedure

ScenarioProcedure
Upgrade Percona PostgreSQL from one major version to another (for example from 17 to 18) on a cluster that uses pg_tdeUse this pg_tde_upgrade procedure
Upgrade the pg_tde extension or package version within the same PostgreSQL major versionFollow the pg_tde upgrade procedure
Upgrade PostgreSQL from one major version to another on a cluster that does not use pg_tdeUse pg_upgrade and follow the major upgrade procedure
Upgrade Percona PostgreSQL to a newer minor version within the same major version (for example from 18.3 to 18.4)Follow the minor upgrade procedure

Implementation

pg_tde_upgrade copies the pg_tde subdirectory from the old data directory to the new data directory and then runs pg_upgrade as normal except for using pg_tde_resetwal instead of pg_resetwal.

Note

Ensure that pg_tde is included in shared_preload_libraries and that you have the right setting for pg_tde.wal_encrypt in the new cluster.

Usage

Use pg_tde_upgrade in place of pg_upgrade when performing a PostgreSQL major version upgrade on a cluster that uses pg_tde.

pg_tde_upgrade accepts the same command-line arguments as pg_upgrade.

Example:

pg_tde_upgrade \
  --old-bindir ... \
  --new-bindir ... \
  --old-datadir ... \
  --new-datadir ...

For more information on how to perform the upgrade for minor versions, see Minor Upgrade of Percona Distribution for PostgreSQL .

For more information on how to perform the upgrade for the pg_tde package version, see Upgrade pg_tde.

PG.CENTER edition · Upstream source

18 - Release notes

Release history and upgrade information for pg_tde.

This is the Percona pg_tde 2.3.0 manual. For the paired build, backup tools and major upgrades, see PG TDE on Mimus.

Latest: pg_tde 2.3.0, published on November 17, 2026.

PG.CENTER edition · Upstream source

18.1 - pg_tde 2.3.0 (2026-11-17)

PostgreSQL 19 support and updated WAL diagnostics in pg_tde 2.3.0.

This is the Percona pg_tde 2.3.0 manual. For the paired build, backup tools and major upgrades, see PG TDE on Mimus.

Release date

The 2.3.0 tag was published on November 17, 2026. The upstream documentation date variable was still TBD at this pinned revision.

The pg_tde extension, provided by Percona, adds Transparent Data Encryption (TDE) to PostgreSQL and helps protect sensitive data at rest.

Get Started

Release Highlights

pg_tde 2.3.0 adds support for PostgreSQL 19 and makes pg_tde_waldump aware of the pg_tde custom resource manager. For more details, see the Changelog.

Known issues

  • The default mlock limit on Rocky Linux 8 for ARM64-based architectures equals the memory page size and is 64 Kb. This results in the child process with pg_tde failing to allocate another memory page because the max memory limit is reached by the parent process.

    To prevent this, you can change the mlock limit to be at least twice the memory page size:

    • temporarily for the current session using the ulimit -l <value> command.
    • set a new hard limit in the /etc/security/limits.conf file. To do so, you require the superuser privileges.

    Adjust the limits with caution since it affects other processes running in your system.

Changelog

Changes introduced in pg_tde 2.3.0:

New Features

Improvements

  • PG-2754 - pg_tde_waldump now recognises the pg_tde custom resource manager, prints proper data for its records and accepts it in the --rmgr filter

PG.CENTER edition · Upstream source

18.2 - pg_tde 2.2.2 (2026-08-20)

Changes, compatibility notes, and fixes for pg_tde 2.2.2 (2026-08-20).

This is the Percona pg_tde 2.3.0 manual. For the paired build, backup tools and major upgrades, see PG TDE on Mimus.

The pg_tde extension, provided by Percona, adds Transparent Data Encryption (TDE) to PostgreSQL and helps protect sensitive data at rest.

Get Started

Release Highlights

pg_tde 2.2.2 focuses on fixing an issue with performance of WAL encryption and adding support for KMIP with HashiCorp Vault Enterprise. Vault Enterprise was already supported via the Vault V2 protocol, but now KMIP can be used too.

Warning

pg_tde 2.2.2 is not compatible with Percona Distribution for PostgreSQL older than 17.10.2 or 18.4.2.

Known issues

  • The default mlock limit on Rocky Linux 8 for ARM64-based architectures equals the memory page size and is 64 Kb. This results in the child process with pg_tde failing to allocate another memory page because the max memory limit is reached by the parent process.

    To prevent this, you can change the mlock limit to be at least twice the memory page size:

    • temporarily for the current session using the ulimit -l <value> command.
    • set a new hard limit in the /etc/security/limits.conf file. To do so, you require the superuser privileges.

    Adjust the limits with caution since it affects other processes running in your system.

Changelog

Changes introduced in pg_tde 2.2.2:

New Features

  • PG-2125 - Support using HashiCorp Vault Enterprise with KMIP
  • PG-2473 - Basic support for building on Windows with Microsoft Visual C++

Improvements

  • PG-2494 - Improved performance of WAL encryption

Bug Fixes

  • PG-2492 - Fixed crash when empty certificate parameters are passed to pg_tde_add_global_key_provider_kmip() or pg_tde_add_database_key_provider_kmip()
  • PG-2608 - Fixed a race condition in the Vault key provider that could occur when multiple processes accessed the same cURL handle after a fork.
  • PG-2609 - Fixed WAL archiving (pg_tde_archive_decrypt and pg_tde_restore_encrypt) when pg_wal dir is a symlink.
  • Include bugfixes for frontend tools from PostgreSQL 16.15, 17.11 and 18.5

PG.CENTER edition · Upstream source

18.3 - pg_tde 2.2.1 (2026-07-06)

Changes, compatibility notes, and fixes for pg_tde 2.2.1 (2026-07-06).

This is the Percona pg_tde 2.3.0 manual. For the paired build, backup tools and major upgrades, see PG TDE on Mimus.

Historical release

This page describes this release at publication time. For current deployment requirements, read the supported versions and limitations.

The pg_tde extension, provided by Percona, adds Transparent Data Encryption (TDE) to PostgreSQL and helps protect sensitive data at rest.

Get Started

Release Highlights

pg_tde 2.2.1 focuses on stability and compatibility improvements. This release improves pg_rewind reliability. For more details, see the Changelog.

Warning

pg_tde 2.2.1 is not compatible with Percona Distribution for PostgreSQL older than 17.10.2 or 18.4.2.

Known issues

  • The default mlock limit on Rocky Linux 8 for ARM64-based architectures equals the memory page size and is 64 Kb. This results in the child process with pg_tde failing to allocate another memory page because the max memory limit is reached by the parent process.

    To prevent this, you can change the mlock limit to be at least twice the memory page size:

    • temporarily for the current session using the ulimit -l <value> command.
    • set a new hard limit in the /etc/security/limits.conf file. To do so, you require the superuser privileges.

    Adjust the limits with caution since it affects other processes running in your system.

Changelog

Changes introduced in pg_tde 2.2.1:

New Features

Bug Fixes

  • PG-2407 - Fixed multiple issues affecting pg_rewind for pg_tde clusters, improving reliability during rewind and recovery operations.
  • PG-2258 - Fixed “could not find server principal key” error from pg_tde_basebackup

Changes

  • Remove support for building pg_tde with make, now it can only be built with Meson

PG.CENTER edition · Upstream source

18.4 - pg_tde 2.2.0 (2026-05-20)

Changes, compatibility notes, and fixes for pg_tde 2.2.0 (2026-05-20).

This is the Percona pg_tde 2.3.0 manual. For the paired build, backup tools and major upgrades, see PG TDE on Mimus.

Historical release

This page describes this release at publication time. For current deployment requirements, read the supported versions and limitations.

The pg_tde extension, provided by Percona, adds Transparent Data Encryption (TDE) to PostgreSQL and helps protect sensitive data at rest.

Get Started

Release Highlights

pg_tde now supports 256-bit AES encryption and introduces pg_tde_upgrade, a utility that simplifies the upgrades of encrypted clusters. For more details, see the Changelog.

Warning

pg_tde 2.2.0 is not compatible with Percona Distribution for PostgreSQL older than 17.10 or 18.4.

Documentation updates

  • The Limitations of pg_tde topic is updated to include a new section on known incompatibilities with Citus and TimescaleDB, and a clarification of the ALTER DATABASE ... SET TABLESPACE behavior, the command can be used but with restrictions when pg_tde is active.
  • The Backup with WAL encryption enabled topic is updated with a clearer description of the key rotation limitation during backups.

Known issues

  • pg_rewind and pg_tde_rewind

    Using pg_rewind or pg_tde_rewind between diverged nodes in clusters that use pg_tde may lead to corrupted tables or indexes due to internal encryption key differences between clusters.

    Queries may fail with:

    ERROR: invalid page in block 0 of relation "base/..."

    This behavior is a known issue.

    For more information, see pg_tde limitations.

  • The default mlock limit on Rocky Linux 8 for ARM64-based architectures equals the memory page size and is 64 Kb. This results in the child process with pg_tde failing to allocate another memory page because the max memory limit is reached by the parent process.

    To prevent this, you can change the mlock limit to be at least twice the memory page size:

    • temporarily for the current session using the ulimit -l <value> command.
    • set a new hard limit in the /etc/security/limits.conf file. To do so, you require the superuser privileges.

    Adjust the limits with caution since it affects other processes running in your system.

Changelog

Changes introduced in pg_tde 2.2.0:

New Features

  • PG-1968 - AES-256 encryption support, pg_tde now supports 256-bit AES encryption, providing stronger cryptographic protection for encrypted tablespaces.
  • PG-2017 - AES-256 compatibility for pg_tde_resetwal, the pg_tde_resetwal utility has been updated to work correctly with AES-256 encrypted data.
  • PG-2018 - AES-256 compatibility for pg_tde_basebackup, the pg_tde_basebackup utility now fully supports AES-256 encryption, ensuring consistent backup and restore behavior for databases using the new cipher.
  • PG-2240 - Introducing pg_tde_upgrade, a utility that automates the steps required to upgrade a pg_tde-enabled cluster, making the upgrade process more convenient.

Improvements

  • PG-2278 - Storage manager (SMGR) encryption has been optimized to reuse OpenSSL cipher contexts, reducing overhead and improving throughput for encrypted I/O operations.

Bug Fixes

  • PG-2240 - Fixed an issue where pg_upgrade would fail when run against databases containing encrypted data.
  • PG-1895 - Resolved a bug where performing WAL key rotation or SMGR key rotation during a pg_basebackup operation could prevent the secondary server from starting successfully.
  • PG-2125 - Fixed key creation failures that occurred when pg_tde was configured to use HashiCorp Vault via the KMIP protocol.

PG.CENTER edition · Upstream source

18.5 - pg_tde 2.1.2 (2026-03-02)

Changes, compatibility notes, and fixes for pg_tde 2.1.2 (2026-03-02).

This is the Percona pg_tde 2.3.0 manual. For the paired build, backup tools and major upgrades, see PG TDE on Mimus.

Historical release

This page describes this release at publication time. For current deployment requirements, read the supported versions and limitations.

The pg_tde extension, provided by Percona, adds Transparent Data Encryption (TDE) to PostgreSQL and helps protect sensitive data at rest.

Get Started

Release Highlights

Documentation updates

  • The Architecture documentation is redesigned for improved clarity and readability. The chapter is now split into smaller, more focused sections.
  • The Technical reference overview is updated with quick-skim cards for quick topic access.
  • A dedicated Usage reference topic is introduced which describes the main pg_tde operations available.

Known issues

  • pg_rewind and pg_tde_rewind

    Using pg_rewind or pg_tde_rewind between diverged nodes in clusters that use pg_tde may lead to corrupted tables or indexes due to internal encryption key differences between clusters.

    Queries may fail with:

    ERROR: invalid page in block 0 of relation "base/..."

    This behavior is a known issue.

    For more information, see pg_tde limitations.

  • pg_upgrade is currently unsupported when pg_tde is enabled

    PostgreSQL clusters that use pg_tde cannot currently be upgraded using pg_upgrade.

  • Do not create, change, or rotate global key providers (or their keys) while pg_tde_basebackup is running. Doing so may cause standbys or clusters initialized from the backup to fail during WAL replay and may result in corruption of encrypted data (tables, indexes, and other relations).

  • Using pg_tde_basebackup with --wal-method=fetch produces warnings.

    This behavior is expected and will be addressed in a future release.

  • The default mlock limit on Rocky Linux 8 for ARM64-based architectures equals the memory page size and is 64 Kb. This results in the child process with pg_tde failing to allocate another memory page because the max memory limit is reached by the parent process.

    To prevent this, you can change the mlock limit to be at least twice bigger than the memory page size:

    • temporarily for the current session using the ulimit -l <value> command.
    • set a new hard limit in the /etc/security/limits.conf file. To do so, you require the superuser privileges.

    Adjust the limits with caution since it affects other processes running in your system.

Changelog

Improvements

  • PG-2088 , PG-2179 - Improved handling of Vault/OpenBao KV v2 mount point validation in pg_tde. The extension no longer fails when configured with tokens that lack access to mount metadata endpoints and now works correctly with tokens that have only the required KV v2 read/write permissions.

Bugs Fixed

  • Updated pg_tde CLI tools to include upstream bug fixes and stability improvements from PostgreSQL 18.2 and 17.8.

PG.CENTER edition · Upstream source

18.6 - pg_tde 2.1.1 (2026-01-22)

Changes, compatibility notes, and fixes for pg_tde 2.1.1 (2026-01-22).

This is the Percona pg_tde 2.3.0 manual. For the paired build, backup tools and major upgrades, see PG TDE on Mimus.

Historical release

This page describes this release at publication time. For current deployment requirements, read the supported versions and limitations.

The pg_tde extension, provided by Percona, adds Transparent Data Encryption (TDE) to PostgreSQL and helps protect sensitive data at rest.

Get Started

Release Highlights

Integrated Hashicorp Vault namespace

The namespace of Hashicorp vault is integrated with pg_tde through the pg_tde_add_global_key_provider_vault_v2 parameter.

Documentation updates

Updated the Global Principal Key configuration and Configure WAL encryption chapters with updated installation steps and removed outdated KMS configuration information.

Known issues

  • Creating, changing, or rotating global key providers (or their keys) while pg_tde_basebackup is running may cause standbys or standalone clusters initialized from the backup to fail during WAL replay and may also lead to the corruption of encrypted data (tables, indexes, and other relations).

    Avoid making these actions during backup windows. Run a new full backup after completing a rotation or provider update.

  • Using pg_tde_basebackup with --wal-method=fetch produces warnings.

    This behavior is expected and will be addressed in a future release.

  • The default mlock limit on Rocky Linux 8 for ARM64-based architectures equals the memory page size and is 64 Kb. This results in the child process with pg_tde failing to allocate another memory page because the max memory limit is reached by the parent process.

    To prevent this, you can change the mlock limit to be at least twice bigger than the memory page size:

    • temporarily for the current session using the ulimit -l <value> command.
    • set a new hard limit in the /etc/security/limits.conf file. To do so, you require the superuser privileges.

    Adjust the limits with caution since it affects other processes running in your system.

Changelog

New Features

  • PG-1959 - Namespace of Hashicorp vault is integrated with pg_tde

PG.CENTER edition · Upstream source

18.7 - pg_tde 2.1.0 (2025-11-28)

Changes, compatibility notes, and fixes for pg_tde 2.1.0 (2025-11-28).

This is the Percona pg_tde 2.3.0 manual. For the paired build, backup tools and major upgrades, see PG TDE on Mimus.

Historical release

This page describes this release at publication time. For current deployment requirements, read the supported versions and limitations.

The pg_tde by Percona extension brings Transparent Data Encryption (TDE) to PostgreSQL and enables you to keep sensitive data safe and secure.

Get Started

Release Highlights

Added support for PostgreSQL 18.1

pg_tde is fully supported with the Postgres 18.1 version.

Packaging changes for PostgreSQL 18

Starting with PostgreSQL 18, pg_tde is distributed as a standalone package for RPM and DEB installations.

It is no longer bundled with the main PostgreSQL server package.

If your PostgreSQL 18 deployment uses pg_tde, make sure to install the matching pg_tde package separately.

Percona’s PostgreSQL Docker images continue to include pg_tde by default, so no additional action is required for container-based deployments.

For more information on the availability by PostgreSQL version, please see Install pg_tde.

Added support for AIO

Added support for asynchronous I/O (AIO) which is now the default I/O mechanism.

Added namespace support for Vault Enterprise and OpenBao

Added support for HashiCorp Vault and OpenBao namespaces. The namespace parameter is now documented in Add or modify Vault providers and fully supported.

Repository split for multi-version PostgreSQL support

Reorganized the project into a multi-repository structure to support several PostgreSQL versions more efficiently.

Tooling changes

The standard PostgreSQL command-line utilities can no longer operate on clusters encrypted with pg_tde. To manage encrypted data safely, use the pg_tde_ equivalents provided by Percona:

  • pg_basebackup to pg_tde_basebackup
  • pg_checksums to pg_tde_checksums
  • pg_resetwal to pg_tde_resetwal
  • pg_rewind to pg_tde_rewind
  • pg_waldump to pg_tde_waldump
Warning

The non-pg_tde_* versions will not work on encrypted clusters and may fail with errors if used. Always use the pg_tde_ variants when working with TDE-enabled data.

Added Akeyless support

pg_tde is now compatible with the Akeyless CipherTrust Manager via the KMIP protocol. For more information, see the Key management overview topic.

Added support for Vault and OpenBao namespaces

Implemented support for the “namespace” feature in Vault Enterprise and OpenBao, available both on the CLI and on the HTTP interface using the X-Vault-Namespace header.

Documentation updates

Known issues

  • Creating, changing, or rotating global key providers (or their keys) while pg_tde_basebackup is running may cause standbys or standalone clusters initialized from the backup to fail during WAL replay and may also lead to the corruption of encrypted data (tables, indexes, and other relations).

    Avoid making these actions during backup windows. Run a new full backup after completing a rotation or provider update.

  • Using pg_tde_basebackup with --wal-method=fetch produces warnings.

    This behavior is expected and will be addressed in a future release.

  • The default mlock limit on Rocky Linux 8 for ARM64-based architectures equals the memory page size and is 64 Kb. This results in the child process with pg_tde failing to allocate another memory page because the max memory limit is reached by the parent process.

    To prevent this, you can change the mlock limit to be at least twice bigger than the memory page size:

    • temporarily for the current session using the ulimit -l <value> command.
    • set a new hard limit in the /etc/security/limits.conf file. To do so, you require the superuser privileges.

    Adjust the limits with caution since it affects other processes running in your system.

PG.CENTER edition · Upstream source

18.8 - pg_tde 2.0.0 (2025-09-01)

Changes, compatibility notes, and fixes for pg_tde 2.0.0 (2025-09-01).

This is the Percona pg_tde 2.3.0 manual. For the paired build, backup tools and major upgrades, see PG TDE on Mimus.

Historical release

This page describes this release at publication time. For current deployment requirements, read the supported versions and limitations.

The pg_tde by Percona extension brings Transparent Data Encryption (TDE) to PostgreSQL and enables you to keep sensitive data safe and secure.

Get Started

Release Highlights

WAL encryption is now generally available

The WAL (Write-Ahead Logging) encryption feature is now fully supported and production-ready, it adds secure write-ahead logging to pg_tde, expanding Percona’s PostgreSQL encryption coverage by enabling secure, transparent encryption of write-ahead logs using the same key infrastructure as data encryption.

WAL encryption upgrade limitation

Clusters that used WAL encryption in the beta release (pg_tde 1.0 or older) cannot be upgraded to pg_tde 2.0. The following error indicates that WAL encryption was enabled:

FATAL: principal key not configured
HINT: Use pg_tde_set_server_key_using_global_key_provider() to configure one.

Clusters that did not use WAL encryption in beta can be upgraded normally.

Documentation updates

  • Updated the Limitations topic, it now includes WAL encryption limitations and both supported and unsupported WAL tools
  • PG-1858 - Added a new topic for Backup with WAL encryption enabled that includes restoring a backup created with WAL encryption
  • PG-1832 - Added documentation for using the pg_tde_archive_decrypt and pg_tde_restore_encrypt utilities. These tools are now covered in CLI Tools to guide users on how to archive and restore encrypted WAL segments securely
  • PG-1740 - Updated documentation for uninstalling pg_tde with WAL encryption enabled and improved the uninstall instructions to cover cases where TDE is disabled while WAL encryption remains active

Known issues

  • Creating, changing, or rotating global key providers (or their keys) while pg_basebackup is running may cause standbys or standalone clusters initialized from the backup to fail during WAL replay and may also lead to the corruption of encrypted data (tables, indexes, and other relations).

    Avoid making these actions during backup windows. Run a new full backup after completing a rotation or provider update.

  • Using pg_basebackup with --wal-method=fetch produces warnings.

    This behavior is expected and will be addressed in a future release.

  • The default mlock limit on Rocky Linux 8 for ARM64-based architectures equals the memory page size and is 64 Kb. This results in the child process with pg_tde failing to allocate another memory page because the max memory limit is reached by the parent process.

    To prevent this, you can change the mlock limit to be at least twice bigger than the memory page size:

    • temporarily for the current session using the ulimit -l <value> command.
    • set a new hard limit in the /etc/security/limits.conf file. To do so, you require the superuser privileges.

    Adjust the limits with caution since it affects other processes running in your system.

Changelog

New Features

  • PG-1497 WAL encryption is now generally available (GA)
  • PG-1037 - Added support for pg_rewind with encrypted WAL
  • PG-1411 - Added support for pg_resetwal with encrypted WAL
  • PG-1603 - Added support for pg_basebackup with encrypted WAL
  • PG-1710 - Added support for WAL archiving with encrypted WAL
  • PG-1711 - Added support for incremental backups with encrypted WAL, compatibility has been verified with pg_combinebackup and the WAL summarizer tool.
  • PG-1712 - Added support for pg_createsubscriber with encrypted WAL
  • PG-1833 - Added verified support for using pg_waldump with encrypted WAL
  • PG-1834 - Verified pg_upgrade with encryption

Improvements

  • PG-1661 - Added validation for key material received from providers
  • PG-1667 - Validated Vault keyring engine type

Bugs Fixed

  • PG-1391 - Fixed unencrypted checkpoint segment on replica with encrypted key
  • PG-1412 – Fixed an issue where XLogFileCopy failed with encrypted WAL during PITR and pg_rewind
  • PG-1452 - Fixed an issue where pg_tde_change_key_provider did not work without the -D flag even if PGDATA was set
  • PG-1485 - Fixed an issue where streaming replication failed with an invalid magic number in WAL when wal_encryption was enabled
  • PG-1604 - Fixed a crash during standby promotion caused by an invalid magic number when replaying two-phase transactions from WAL
  • PG-1658 - Fixed an issue where the global key provider could not be deleted after server restart
  • PG-1835 - Fixed an issue where pg_resetwal corrupted encrypted WAL, causing PostgreSQL to fail at startup with an invalid checkpoint
  • PG-1842 - Fixed a delay in replica startup with encrypted tables in streaming replication setups
  • PG-1843 - Fixed performance issues when creating encrypted tables
  • PG-1863 - Fixed an issue where unnecessary WAL was generated when creating temporary tables
  • PG-1866 - Fixed an issue where automatic restart after crash sometimes failed with WAL encryption enabled
  • PG-1867 - Fixed archive recovery with encrypted WAL

PG.CENTER edition · Upstream source

18.9 - pg_tde 1.0.0 (2025-06-30)

Changes, compatibility notes, and fixes for pg_tde 1.0.0 (2025-06-30).

This is the Percona pg_tde 2.3.0 manual. For the paired build, backup tools and major upgrades, see PG TDE on Mimus.

Historical release

This page describes this release at publication time. For current deployment requirements, read the supported versions and limitations.

The pg_tde by Percona extension brings in Transparent Data Encryption (TDE) to PostgreSQL and enables you to keep sensitive data safe and secure.

Get Started

Release Highlights

  • pg_tde 1.0 is now GA (Generally Available)

And stable for encrypting relational data in PostgreSQL using Transparent Data Encryption (TDE) . This milestone brings production-level data protection to PostgreSQL workloads.

  • WAL encryption is still in Beta

The WAL encryption feature is currently still in beta and is not effective unless explicitly enabled. It is not yet production ready. Do not enable this feature in production environments.

Upgrade considerations

pg_tde 1.0 is not backward compatible with previous pg_tde versions, like Release Candidate 2, due to significant changes in code. This means you cannot directly upgrade from one version to another. You must do a clean installation of pg_tde.

Known issues

  • The default mlock limit on Rocky Linux 8 for ARM64-based architectures equals the memory page size and is 64 Kb. This results in the child process with pg_tde failing to allocate another memory page because the max memory limit is reached by the parent process.

To prevent this, you can change the mlock limit to be at least twice bigger than the memory page size:

  • temporarily for the current session using the ulimit -l <value> command.
  • set a new hard limit in the /etc/security/limits.conf file. To do so, you require the superuser privileges.

Adjust the limits with caution since it affects other processes running in your system.

Changelog

New Features

  • PG-1257 – Added SQL function to remove the current principal key

Improvements

  • PG-1617 – Removed relation key cache
  • PG-1635 – User-facing TDE functions now return void
  • PG-1605 – Removed undeclared dependencies for pg_tde_grant_database_key_management_to_role()

Bugs Fixed

  • PG-1581 – Fixed PostgreSQL crashes on table access when KMIP key is unavailable after restart
  • PG-1583 – Fixed a crash when dropping the pg_tde extension with CASCADE after changing the key provider file
  • PG-1585 – Fixed the vault provider re-addition that failed after server restart with a new token
  • PG-1592 – Improve error logs when Server Key Info is requested without being created
  • PG-1593 – Fixed runtime failures when invalid Vault tokens are allowed during key provider creation
  • PG-1600 – Fixed Postmaster error when dropping a table with an unavailable key provider
  • PG-1606 – Fixed missing superuser check in role grant function leads to misleading errors
  • PG-1607 – Improved CA parameter order and surrounding documentation for clearer interpretation
  • PG-1608 – Updated and fixed global key configuration parameters in documentation
  • PG-1613 – Tested and improved the pg_tde_change_key_provider CLI utility
  • PG-1637 – Fixed unused keys in key files which caused issues after OID wraparound
  • PG-1651 – Fixed the CLI tool when working with Vault key export/import
  • PG-1652 – Fixed when the server fails to find encryption keys after CLI-based provider change
  • PG-1662 – Fixed the creation of inconsistent encryption status when altering partitioned tables
  • PG-1663 – Fixed the indexes on partitioned tables which were not encrypted
  • PG-1700 – Fixed the error hint when the principal key is missing

PG.CENTER edition · Upstream source

18.10 - pg_tde Release Candidate 2 (2025-05-29)

Changes, compatibility notes, and fixes for pg_tde Release Candidate 2 (2025-05-29).

This is the Percona pg_tde 2.3.0 manual. For the paired build, backup tools and major upgrades, see PG TDE on Mimus.

Historical release

This page describes this release at publication time. For current deployment requirements, read the supported versions and limitations.

pg_tde extension brings in Transparent Data Encryption (TDE) to PostgreSQL and enables you to keep sensitive data safe and secure.

Get Started

Release Highlights

This release provides the following features and improvements:

  • Restricted key provider configuration to superusers

    The database owners can no longer configure key providers directly. Instead, they must refer to the superuser who manages the provider setup. This security improvement clearly separates the responsibilities between users and administrators.

  • WAL encryption supports Vault.

    pg_tde now supports using the Vault keyring for secure storage and management of WAL encryption keys.

  • Automatic WAL internal key generation at server startup.

    On each server start, a new internal key is generated for encrypting subsequent WAL records (assuming WAL encryption is enabled). The existing WAL records and their keys remain unchanged, this ensures continuity and secure key management without affecting historical data.

  • Proper removal of relation-level encryption keys on table drop

    Previously, encrypted relation keys persisted even after dropping the associated tables, potentially leaving orphaned entries in the map file. This is now corrected, when an encrypted table is dropped, its corresponding key is also removed from the key map.

  • Fixed external tablespace data loss with encrypted partitions

    An issue was fixed where data could be lost when the encrypted partitioned tables were moved to external tablespaces.

  • New visibility and verification functions for default principal keys

    Added additional functions to help you verify and inspect the state of default principal keys more easily.

  • Fixed SQL failures caused by inconsistent key provider switching

    An issue was resolved where SQL queries could fail after switching key providers while the server was running. This occurred because principal keys became inaccessible when spread across multiple keyring backends, triggering the single-provider-at-a-time design constraint. pg_tde now enforces consistency during provider changes to prevent a corrupted key state and query errors.

Upgrade considerations

pg_tde Release Candidate 2 is not backward compatible with pg_tde Beta2 due to significant changes in code. This means you cannot directly upgrade from one version to another. You must uninstall pg_tde Beta2 first and then install and configure the new Release Candidate version.

Known issues

  • The default mlock limit on Rocky Linux 8 for ARM64-based architectures equals the memory page size and is 64 Kb. This results in the child process with pg_tde failing to allocate another memory page because the max memory limit is reached by the parent process.

To prevent this, you can change the mlock limit to be at least twice bigger than the memory page size:

  • temporarily for the current session using the ulimit -l <value> command.
  • set a new hard limit in the /etc/security/limits.conf file. To do so, you require the superuser privileges.

Adjust the limits with caution since it affects other processes running in your system.

Changelog

New Features

  • PG-817 – Added fuzz testing to pstress to strengthen validation and resilience.
  • PG-824 – Ensured fsync is called on pg_tde.map, pg_tde.dat, and FS key provider files.
  • PG-830 – Implemented full WAL encryption using Vault keyring.
  • PG-831 – Tested WAL recovery and both streaming and logical replication compatibility.
  • PG-855 – Added a contributor guide to help new developers engage with pg_tde.
  • PG-938 – Evaluated use of pg_basebackup for automated backup validation with pg_tde.
  • PG-962 – Automated test cases to validate data integrity after PostgreSQL restart.
  • PG-1001 – Verified encryption behavior of temporary tables.
  • PG-1099 – Developed automation for bare-metal performance benchmarking.
  • PG-1289 – Added test cases for verifying compatibility with different PostgreSQL versions.
  • PG-1444 – Implemented support for removing relation-level encryption keys when dropping tables.
  • PG-1455 – Introduced random base numbers in encryption IVs for enhanced security.
  • PG-1458 – Added visibility and verification functions for default principal keys.
  • PG-1460 – Enabled automatic rotation of WAL internal keys on server start.
  • PG-1461 – Implemented random IV initialization for WAL keys.
  • PG-1506 – Added parameter support for client certificates in KMIP provider configuration.

Improvements

  • PG-826 – Documented how to encrypt and decrypt existing tables using pg_tde.
  • PG-827 – Fixed CI pipeline tests on the smgr branch.
  • PG-834 – Resolved issues with CREATE ... USING pg_tde on the smgr branch.
  • PG-1427 – Tested and fixed KMIP implementation for Thales support.
  • PG-1507 – Handled ALTER TYPE operations in the TDE event trigger.
  • PG-1508 – Fixed encryption state inconsistencies when altering inherited tables.
  • PG-1550 – Restricted database owners from creating key providers to improve security.
  • PG-1586 – Verified and fixed KMIP compatibility with Fortanix HSM.

Bugs Fixed

  • PG-1397 – Fixed segmentation fault during replication with WAL encryption enabled.
  • PG-1413 – Resolved invalid WAL magic number errors after toggling encryption.
  • PG-1416 – Fixed SQL query failures caused by inconsistent key provider switching.
  • PG-1468 – Fixed WAL read failures on replicas after key rotation.
  • PG-1491 – Corrected pg_tde_is_encrypted() behavior for partitioned tables.
  • PG-1493 – Fixed data loss when encrypted partitioned tables were moved to external tablespaces.
  • PG-1503 – Blocked deletion of global key providers still associated with principal keys.
  • PG-1504 – Ensured correct encryption inheritance in partitioned tde_heap tables.
  • PG-1510 – Used different keys and IVs for PostgreSQL forks to prevent conflicts.
  • PG-1530 – Fixed inability to read WAL after toggling WAL encryption.
  • PG-1532 – Resolved errors rewriting owned sequences when pg_tde isn’t in the default schema.
  • PG-1535 – Prevented server crash on calling pg_tde_principal_key_info().
  • PG-1537 – Fixed crash on NULL input in user-facing functions.
  • PG-1539 – Handled principal key header verification errors gracefully.
  • PG-1540 – Ensured sequences are assigned correct encryption status.
  • PG-1541 – Resolved WAL decryption failure after key rotation.
  • PG-1543 – Fixed validation error when multiple server keys exist.
  • PG-1545 – Resolved error from pg_tde_grant_grant_management_to_role() execution.
  • PG-1546 – Fixed incorrect behavior in role grant function.
  • PG-1551 – Improved handling of short reads and errors in WAL storage code.
  • PG-1571 – Fixed WAL decryption failure due to corrupted or mismatched principal keys.
  • PG-1573 – Prevented crash during WAL replay when lock was not held.
  • PG-1574 – Ensured encrypted WAL is readable by streaming replica.
  • PG-1576 – Resolved crash from malformed JSON in user-facing functions.

PG.CENTER edition · Upstream source

18.11 - pg_tde Release Candidate 1 (2025-03-27)

Changes, compatibility notes, and fixes for pg_tde Release Candidate 1 (2025-03-27).

This is the Percona pg_tde 2.3.0 manual. For the paired build, backup tools and major upgrades, see PG TDE on Mimus.

Historical release

This page describes this release at publication time. For current deployment requirements, read the supported versions and limitations.

pg_tde extension brings in Transparent Data Encryption (TDE) to PostgreSQL and enables you to keep sensitive data safe and secure.

Get started

Release Highlights

This release provides the following features and improvements:

  • Improved performance with redesigned WAL encryption.

    The approach to WAL encryption has been redesigned. Now, pg_tde encrypts entire WAL files starting from the first WAL write after the server was started with the encryption turned on. The information about what is encrypted is stored in the internal key metadata. This change improves WAL encryption flow with native replication and increases performance for large scale databases.

  • Default encryption key for single-tenancy.

    The new functionality allows you to set a default principal key for the entire database cluster. This key is used to encrypt all databases and tables that do not have a custom principal key set. This feature simplifies encryption configuration and management in single-tenant environments where each user has their own database instance.

  • Ability to change key provider configuration

    You no longer need to configure a new key provider and set a new principal key if the provider’s configuration changed. Now can change the key provider configuration both for the current database and the entire PostgreSQL cluster using functions. This enhancement lifts existing limitations and is a native and common way to operate in PostgreSQL.

  • Key management permissions

    The new functions allow you to manage permissions for global and database key management separately. This feature provides more granular control over key management operations and allows you to delegate key management tasks to different roles.

  • Additional information about principal keys and providers

    The new functions allow you to display additional information about principal keys and providers. This feature helps you to understand the current key configuration and troubleshoot issues related to key management.

  • tde_heap_basic access method deprecation

    The tde_heap_basic access method has limitations in encryption capabilities and affects performance. Also, it poses a potential security risk when used in production environments due to indexes remaining unencrypted. Considering all the above, we decided to deprecate this access method and remove it in future releases. Use the tde_heap access method instead that is available with Percona Server for PostgreSQL 17 - a drop-in replacement for PostgreSQL Community.

Upgrade considerations

pg_tde Release Candidate is not backward compatible with pg_tde Beta2 due to significant changes in code. This means you cannot directly upgrade from one version to another. You must uninstall pg_tde Beta2 first and then install and configure the new Release Candidate version.

Known issues

  • The default mlock limit on Rocky Linux 8 for ARM64-based architectures equals the memory page size and is 64 Kb. This results in the child process with pg_tde failing to allocate another memory page because the max memory limit is reached by the parent process.

    To prevent this, you can change the mlock limit to be at least twice bigger than the memory page size:

    • temporarily for the current session using the ulimit -l <value> command.
    • set a new hard limit in the /etc/security/limits.conf file. To do so, you require the superuser privileges.

    Adjust the limits with caution since it affects other processes running in your system.

  • You can now delete global key providers even when their associated principal key is still in use. This known issue will be fixed in the next release. For now, avoid deleting global key providers.

Changelog

New Features

  • PG-1234 - Added functions for separate global and database key management permissions.

  • PG-1255 - Added functionality to delete key providers.

  • PG-1256 - Added single-tenant support via the default principal key functionality.

  • PG-1258 - Added functions to display additional information about principal keys / providers.

  • PG-1294 - Redesigned WAL encryption.

  • PG-1303 - Deprecated tde_heap_basic access method.

Improvements

  • PG-858 - Refactored internal/principal key LWLocks to make local databases inherit a global key provider.

  • PG-1243 - Investigated performance issues at a specific threshold and large databases and updated documentation about handling hint bits.

  • PG-1310 - Added access method enforcement via the GUC variable.

  • PG-1361 - Fixed pg_tde relocatability.

  • PG-1380 - Added support for pg_tde_is_encrypted() function on indexes and sequences.

Bugs Fixed

  • PG-821 - Fixed the issue with pg_basebackup failing when configuring replication.

  • PG-847 - Fixed the issue with pg_basebackup and pg_checksum throwing an error on files created by pg_tde when the checksum is enabled on the database cluster.

  • PG-1004 - Fixed the issue with pg_checksums utility failing during checksum verification on pg_tde tables. Now pg_checksum skips encrypted relations by looking if the relation has a custom storage manager (SMGR) key.

  • PG-1373 - Fixed the issue with potential unterminated strings by using the memcpy() or strlcpy() instead of the strncpy() function.

  • PG-1378 - Fixed the issue with toast tables created by the ALTER TABLE command not being encrypted.

  • PG-1379 - Fixed sequence and alter table handling in the event trigger.

  • PG-1222 - Fixed the bug with confused relations with the same RelFileNumber in different databases.

  • PG-1400 - Corrected the pg_tde_change_key_provider naming in help.

  • PG-1401 - Fixed the issue with inheriting an encryption status during the ALTER TABLE SET access method command execution by basing a new encryption status only on the new encryption setting.

  • PG-1414 - Fixed the error message wording when configuring WAL encryption by referencing to a correct function.

  • PG-1450 - Fixed the pg_tde_delete_key_provider() function behavior when called multiple times by ignoring already deleted records.

  • PG-1451 -Fixed the issue with the repeating error message about inability to retrieve a principal key even when a user creates non-encrypted tables by checking the current transaction ID in both the event trigger start function and during a file creation. If the transaction changed during the setup of the current event trigger data, the event trigger is reset.

  • PG-1473 - Allowed only users with key viewer privileges to execute pg_tde_verify_principal_key() and pg_tde_verify_global_principal_key() functions.

  • PG-1474 - Fixed the issue with the principal key reference corruption when reassigning it to a key provider with the same name by setting the key name in vault/kmip getters.

  • [PG-1476](https://perconadev.atlassian.net

PG.CENTER edition · Upstream source

18.12 - pg_tde Beta 2 (2024-12-16)

Changes, compatibility notes, and fixes for pg_tde Beta 2 (2024-12-16).

This is the Percona pg_tde 2.3.0 manual. For the paired build, backup tools and major upgrades, see PG TDE on Mimus.

Historical release

This page describes this release at publication time. For current deployment requirements, read the supported versions and limitations.

pg_tde extension brings in Transparent Data Encryption (TDE) to PostgreSQL and enables you to keep sensitive data safe and secure.

Get started

Important

This version of Percona Transparent Data Encryption extension is not recommended for production environments yet. We encourage you to test it and give your feedback.

This will help us improve the product and make it production-ready faster.

Release Highlights

With this release, pg_tde extension offers two database specific versions:

  • PostgreSQL Community version provides only the tde_heap_basic access method using which you can introduce table encryption and WAL encryption for data in the encrypted tables. Index data remains unencrypted.
  • Version for Percona Server for PostgreSQL provides the tde_heapaccess method. using this method you can encrypt index data in encrypted tables thus increasing the safety of your sensitive data. For backward compatibility, the tde_heap_basic method is available in this version too.

Changelog

The Beta 2 version introduces the following features and improvements:

New Features

  • Added the tde_heap access method with which you can now enable index encryption for encrypted tables and global WAL data encryption. To use this access method, you must install Percona Server for PostgreSQL. Check the installation guide
  • Added event triggers to identify index creation operations on encrypted tables and store those in a custom storage.
  • Added support for secure transfer of keys using the OASIS Key Management Interoperability Protocol (KMIP). The KMIP implementation was tested with the PyKMIP server and the HashiCorp Vault Enterprise KMIP Secrets Engine.

Improvements

  • WAL encryption improvements:

    • Added a global key to encrypt WAL data in global space
    • Added WAL key management
  • Keyring improvements:

    • Renamed functions to point their usage for principal key management
    • Improved keyring provider management across databases and the global space.
    • Keyring configuration now uses common JSON API. This simplifies code handling and enables frontend tools like pg_waldump to read the code thus improving debugging.
  • The pg_tde_is_encrypted function now supports custom schemas in the format of pg_tde_is_encrypted('schema.table');

  • Changed the location of internal TDE files: instead of the database directory, now all files are stored in $PGDATA/pg_tde

  • Improved error reporting when pg_tde is not added to the shared_preload_libraries

  • Improved memory usage of tde_heap_basic during sequential reads

  • Improved tde_heap_basic for select statements

  • Added encryption support for (some) command line utilities

Bugs fixed

  • Fixed multiple bugs with tde_heap_basic and TOAST records
  • Fixed various memory leaks

PG.CENTER edition · Upstream source

18.13 - pg_tde Beta (2024-06-30)

Changes, compatibility notes, and fixes for pg_tde Beta (2024-06-30).

This is the Percona pg_tde 2.3.0 manual. For the paired build, backup tools and major upgrades, see PG TDE on Mimus.

Historical release

This page describes this release at publication time. For current deployment requirements, read the supported versions and limitations.

pg_tde extension brings in Transparent Data Encryption (TDE) to PostgreSQL and enables you to keep sensitive data safe and secure.

Get started

Important

This version of Percona Transparent Data Encryption extension is not recommended for production environments yet. We encourage you to test it and give your feedback.

This will help us improve the product and make it production-ready faster.

Release Highlights

Starting with pg_tde Beta, the access method for pg_tde extension is renamed tde_heap_basic. Use this access method name to create tables. Find guidelines in Test TDE tutorial.

Changelog

  • Fixed the issue with pg_tde running out of memory used for decrypted tuples. The fix introduces the new component TDEBufferHeapTupleTableSlot that keeps track of the allocated memory for decrypted tuples and frees this memory when the tuple slot is no longer needed.

  • Fixed the issue with adjusting a current position in a file by using raw file descriptor for the lseek function. (Thanks to user rainhard for providing the fix)

  • Enhanced the init script to consider a custom superuser for the POSTGRES_USER parameter when pg_tde is running via Docker (Thanks to Alejandro Paredero for reporting the issue)

PG.CENTER edition · Upstream source

18.14 - pg_tde Alpha 1 (2024-03-28)

Changes, compatibility notes, and fixes for pg_tde Alpha 1 (2024-03-28).

This is the Percona pg_tde 2.3.0 manual. For the paired build, backup tools and major upgrades, see PG TDE on Mimus.

Historical release

This page describes this release at publication time. For current deployment requirements, read the supported versions and limitations.

pg_tde extension brings in Transparent Data Encryption (TDE) to PostgreSQL and enables you to keep sensitive data safe and secure.

Get started

Important

This version of Percona Transparent Data Encryption extension is not recommended for production environments yet. We encourage you to test it and give your feedback.

This will help us improve the product and make it production-ready faster.

Release Highlights

The Alpha1 version of the extension introduces the following key features:

  • You can now rotate principal keys used for data encryption. This reduces the risk of long-term exposure to potential attacks and helps you comply with security standards such as GDPR, HIPAA, and PCI DSS.

  • You can now configure encryption differently for each database. For example, encrypt specific tables in some databases with different encryption keys while keeping others non-encrypted.

  • Keyring configuration has undergone several improvements, namely:

    • You can define separate keyring configuration for each database
    • You can change keyring configuration dynamically, without having to restart the server
    • The keyring configuration is now stored in a catalog separately for each database, instead of a configuration file
    • Avoid storing secrets in the unencrypted catalog by configuring keyring parameters to be read from external sources (file, http(s) request)

Improvements

  • Renamed the repository and Docker image from postgres-tde-ext to pg_tde. The extension name remains unchanged
  • Changed the Initialization Vector (IV) calculation of both the data and internal keys

Bugs fixed

  • Fixed toast related crashes
  • Fixed a crash with the DELETE statement
  • Fixed performance-related issues
  • Fixed a bug where pg_tde sent many 404 requests to the Vault server
  • Fixed сompatibility issues with old OpenSSL versions
  • Fixed сompatibility with old Curl versions

PG.CENTER edition · Upstream source

18.15 - pg_tde MVP (2023-12-12)

Changes, compatibility notes, and fixes for pg_tde MVP (2023-12-12).

This is the Percona pg_tde 2.3.0 manual. For the paired build, backup tools and major upgrades, see PG TDE on Mimus.

Historical release

This page describes this release at publication time. For current deployment requirements, read the supported versions and limitations.

The Minimum Viable Product (MVP) version of pg_tde introduces the following functionality:

  • Encryption of heap tables, including TOAST
  • Encryption keys are stored either in Hashicorp Vault server or in local keyring file (for development)
  • The key storage is configurable via separate JSON configuration files
  • Replication support

PG.CENTER edition · Upstream source

18.16 - Percona Transparent Data Encryption for PostgreSQL release notes index

The upstream release index, with links to version-specific changes.

This is the Percona pg_tde 2.3.0 manual. For the paired build, backup tools and major upgrades, see PG TDE on Mimus.

Historical release

This page describes this release at publication time. For current deployment requirements, read the supported versions and limitations.

This page lists all release notes for pg_tde, organized by year and version. Use it to track new features, fixes, and updates across major and minor versions.

2026

2025

2024

2023

  • MVP (2023-12-12)

PG.CENTER edition · Upstream source

19 - FAQ

Answers about encryption boundaries, recovery, key rotation, and PostgreSQL compatibility.

This is the Percona pg_tde 2.3.0 manual. For the paired build, backup tools and major upgrades, see PG TDE on Mimus.

Editorial correction

The temporary-file scope and internal-key rotation guidance have been clarified using the current limitations and architecture documentation. Compliance-related statements below reflect the upstream document, not a certification of a particular deployment. See site errata.

Why do I need TDE?

Using TDE provides the following benefits:

  • Compliance to security and legal regulations like General Data Protection Regulation (GDPR), Payment Card Industry Data Security Standard (PCI DSS), California Consumer Privacy Act (CCPA), Data Protection Act 2018 (DPA 2018) and others
  • Encryption of backups. Even when an authorized person gets physical access to a backup, encryption ensures that the data remains unreadable and secure.
  • Granular encryption of specific data sets and reducing the performance overhead that encryption brings.
  • Additional layer of security to existing security measures

When and how should I use TDE?

If you are dealing with Personally Identifiable Information (PII), data encryption is crucial. Especially if you are involved in areas with strict regulations like:

  • financial services where TDE helps to comply with PCI DSS
  • healthcare and insurance - compliance with HIPAA, HITECH, CCPA
  • telecommunications, government and education to ensure data confidentiality.

Using TDE helps you avoid the following risks:

  • Data breaches
  • Identity theft that may lead to financial fraud and other crimes
  • Reputation damage leading to loss of customer trust and business
  • Legal consequences and financial losses for non-compliance with data protection regulations
  • Internal threats by misusing unencrypted sensitive data

For pg_tde, the encrypted scope includes tables using tde_heap and WAL when WAL encryption is enabled. Temporary tables can use tde_heap, but temporary files from operations that exceed work_mem are not encrypted. See the current limitations.

pg_tde does not encrypt system catalogs yet. This means that statistics data and database metadata are not encrypted.

Will logical replication work with pg_tde?

Yes, logical replication works with the encrypted tables.

Does logical replication keep data encrypted on subscribers?

Logical replication does not preserve encryption state. If the publisher uses pg_tde but the subscriber does not, the replicated data will be stored in plain text on the subscriber.

Encryption is not propagated to the data-block level due to how logical replication operates.

Note

This means encrypted publishers do not guarantee encrypted logical replicas.

I use disk-level encryption. Why should I care about TDE?

Encrypting a hard drive encrypts all data, including system, application, and temporary files.

Full disk encryption protects your data from people who have physical access to your device and even if it is lost or stolen. However, it doesn’t protect the data after system boot-up: the data is automatically decrypted when the system runs or when an authorized user requests it.

Another point to consider is PCI DSS compliance for Personal Account Numbers (PAN) encryption.

  • PCI DSS 3.4.1 standards might consider disk encryption sufficient for compliance if you meet these requirements:

    • Separate the logical data access from the operating system authentication.

    • Ensure the decryption key is not linked to user accounts.

    Note that PCI DSS 3.4.1 is retiring on March 31, 2025. Therefore, consider switching to PCI DSS 4.0.

  • PCI DSS 4.0 standards consider using only disk and partition-level encryption not enough to ensure PAN protection. It requires an additional layer of security that pg_tde can provide.

pg_tde focuses specifically on data files and offers more granular control over encrypted data. The data remains encrypted on disk during runtime and when you move it to another directory, another system or storage. An example of such data is backups. They remain encrypted when moved to the backup storage.

Thus, to protect your sensitive data, consider using TDE to encrypt it at the table level. Then use disk-level encryption to encrypt a specific volume where this data is stored, or the entire disk.

Is TDE enough to ensure data security?

No. Transparent Data Encryption (TDE) adds an extra layer of security for data at rest. You should also consider implementing the following additional security features:

  • Access control and authentication
  • Strong network security like TLS
  • Disk encryption
  • Regular monitoring and auditing
  • Additional data protection for sensitive fields (e.g., application-layer encryption)

How does pg_tde make my data safe?

pg_tde uses two keys to encrypt data:

  • Internal encryption keys to encrypt the data. These keys are stored internally in an encrypted format, in a single $PGDATA/pg_tde directory.
  • Principal keys to encrypt internal encryption keys. These keys are stored externally, in the Key Management System (KMS).

You can use the following KMSs:

  • HashiCorp Vault. pg_tde supports the KV secrets engine v2 of Vault, for more information see Vault Configuration.
  • OpenBao implementation of Vault
  • KMIP-compatible servers, KMIP is a standardized protocol for handling cryptographic workloads and secrets management, for more information see KMIP configuration.
Note

HashiCorp Vault can also act as a KMIP server, managing cryptographic keys for clients that use the KMIP protocol. (KMIP functionality is available in Vault’s enterprise edition.)

Let’s break the encryption down into two parts:

Encryption of data files

First, data files are encrypted with internal keys. Each file that has a different Object Identifier (OID) has an internal key. For example, a table with 4 indexes will have 5 internal keys - one for the table and one for each index.

The initial decision on what file to encrypt is based on the table access method in PostgreSQL. When you run a CREATE or ALTER TABLE statement with the USING tde_heap clause, the newly created data files are marked as encrypted, and then file operations encrypt or decrypt the data. Later, if an initial file is re-created as a result of a TRUNCATE or VACUUM FULL command, the newly created file inherits the encryption information and is either encrypted or not.

The principal key is used to encrypt the internal keys. The principal key is stored in the key management store. When you query the table, the principal key is retrieved from the key store to decrypt the table. Then the internal key for that table is used to decrypt the data.

WAL encryption

WAL encryption is done globally for the entire database cluster. All modifications to any database within a PostgreSQL cluster are written to the same WAL to maintain data consistency and integrity and ensure that PostgreSQL cluster can be restored to a consistent state. Therefore, WAL is encrypted globally.

When you turn on WAL encryption, pg_tde encrypts entire WAL files starting from the first WAL write after the server was started with the encryption turned on.

The same 2-key approach is used with WAL as with the table data: WAL pages are first encrypted with the internal key. Then the internal key is encrypted with the global principal key.

You can turn WAL encryption on and off so WAL can contain both encrypted and unencrypted data. The WAL encryption GUC variable influences only writes.

Whenever the WAL is being read (by the recovery process or tools), the decision on what should be decrypted is based solely on the metadata of WAL encryption keys.

Should I encrypt all my data?

It depends on your business requirements and the sensitivity of your data. Encrypting all data is a good practice but it can have a performance impact.

Consider encrypting only tables that store sensitive data. You can decide what tables to encrypt and with what key. The Set up multi-tenancy section in the documentation focuses on this approach.

We advise encrypting the whole database only if all your data is sensitive, like PII, or if there is no other way to comply with data safety requirements.

What cipher mechanisms are used by pg_tde?

pg_tde currently uses the following encryption algorithms:

  • AES-128-CBC, AES-256-CBC for encrypting database files; encrypted with internal keys
  • AES-128-CTR, AES-256-CTR for WAL encryption; encrypted with internal keys
  • AES-128-GCM, AES-256-GCM for encrypting internal keys; encrypted with the principal key

Is post-quantum encryption supported?

No, it’s not yet supported. In our implementation we reply on OpenSSL libraries that don’t yet support post-quantum encryption.

Can I encrypt an existing table?

Yes, you can encrypt an existing table. Run the ALTER TABLE command as follows:

ALTER TABLE table_name SET ACCESS METHOD tde_heap;

Since the SET ACCESS METHOD command drops hint bits and this may affect the performance, we recommend to run the SELECT count(*) command. It checks every tuple for visibility and sets its hint bits. Read more in the Changing existing table section.

Do I have to restart the database to encrypt the data?

You must restart the database in the following cases to apply the changes:

  • after you enabled the pg_tde extension
  • when enabling WAL encryption

After that, no database restart is required. When you create or alter the table using the tde_heap access method, the files are marked as those that require encryption. The encryption happens at the storage manager level, before a transaction is written to disk. Read more about how tde_heap works.

What happens to my data if I lose a principal key?

If you lose encryption keys, especially, the principal key, the data is lost. That’s why it’s critical to back up your encryption keys securely and use the Key Management service for key management.

Can I use pg_tde in a multi-tenant setup?

Multi-tenancy is the type of architecture where multiple users, or tenants, share the same resource. It can be a database, a schema or an entire cluster.

In pg_tde, multi-tenancy is supported via a separate principal key per database. This means that a database owner can decide what tables to encrypt within a database. The same database can have both encrypted and non-encrypted tables.

To control user access to the databases, you can use role-based access control (RBAC).

Are my backups safe? Can I restore from them?

pg_tde encrypts data at rest. This means that data is stored on disk in an encrypted form. During a backup, already encrypted data files are copied from disk onto the storage. This ensures the data safety in backups.

Since the encryption happens on the database level, it makes no difference for your tools and applications. They work with the data in the same way.

To restore from an encrypted backup, you must have the same principal encryption key, which was used to encrypt files in your backup.

I’m using OpenSSL in FIPS mode and need to use pg_tde. Does pg_tde comply with FIPS requirements? Can I use my own FIPS-mode OpenSSL library with pg_tde?

Yes. pg_tde works with the FIPS-compliant version of OpenSSL, whether it is provided by your operating system or if you use your own OpenSSL libraries. If you use your own libraries, make sure they are FIPS certified.

How do I rotate internal encryption keys in pg_tde?

We don’t have a dedicated function to rotate internal keys, because a key is effectively rotated any time a table’s data file is completely rewritten. Operations like VACUUM FULL, TRUNCATE, or some but not all ALTER TABLE commands automatically generate a new internal key.

A table rewrite with VACUUM FULL generates a new internal key. Ordinary VACUUM does not rewrite the whole table. Plan for the exclusive lock and disk space required by VACUUM FULL.

What tools are supported with pg_tde WAL encryption?

For a comprehensive list of supported pg_tde WAL encryption tools see Limitations of pg_tde.

PG.CENTER edition · Upstream source

20 - Contributing Guide

Build, test, and contribute code or documentation to the upstream pg_tde project.

This is the Percona pg_tde 2.3.0 manual. For the paired build, backup tools and major upgrades, see PG TDE on Mimus.

Welcome to pg_tde - the Transparent Data Encryption extension for PostgreSQL!

We’re glad that you would like to become a community member and contribute to this project.

You can contribute in one of the following ways:

  1. Reach us on our Forums.
  2. Submit a bug report or a feature request
  3. Submit a pull request (PR) with the code patch
  4. Contribute to documentation

Prerequisites

Before submitting code contributions, we ask you to complete the following prerequisites.

1. Sign the CLA

Before you can contribute, we kindly ask you to sign our Contributor License Agreement (CLA). You can do this in on click using your GitHub account.

Note: You can sign it later, when submitting your first pull request. The CLA assistant validates the PR and asks you to sign the CLA to proceed.

2. Code of Conduct

Please make sure to read and agree to our Code of Conduct.

Submitting a pull request

All bug reports, enhancements and feature requests are tracked in Jira. Though not mandatory, we encourage you to first check for a bug report among the issues and in the PR list: perhaps the bug has already been addressed.

For feature requests and enhancements, we do ask you to create a GitHub issue, describe your idea and discuss the design with us. This way we align your ideas with our vision for the product development.

If the bug hasn’t been reported / addressed, or we’ve agreed on the enhancement implementation with you, do the following:

  1. Fork this repository

  2. Clone this repository on your machine.

  3. Create a separate branch for your changes. If you work on a Jira issue, please follow this pattern for a branch name: <PG-123>-name. This makes it easier to track your contribution.

  4. Make your changes. Please follow the following guidelines to improve code readability according to the order listed:

  5. Write the documentation for your changes. See the Write the docs cheat sheet for details.

  6. Build the code and test your changes locally.

  7. Commit the changes. The commit message guidelines will help you with writing great commit messages

  8. Open a pull request to Percona.

  9. Our team will review your code and documentation. If everything is correct, will merge it. Otherwise, we will contact you for additional information or with the request to make changes.

Run local tests

When you work, you should periodically run tests to check that your changes don’t break existing code.

To run the tests, use the following command:

ci_scripts/test.sh all

You can run tests on your local machine with whatever operating system you have. After you submit the pull request, we will check your patch on multiple operating systems.

Contribute to documentation

pg_tde documentation is written in Markdown language, so you can write the docs for your code changes or edit the existing documentation online via GitHub. If you wish to have more control over the doc process, jump to how to edit documentation locally.

Before you start, learn what Markdown is and how to write it. For your convenience, there’s also a Markdown cheat sheet to help you with the syntax.

The doc files are in the documentation/docs directory.

Write the docs

When you write code, make sure to write documentation that explains it for users. As the author, you know best how your code works. To explain your feature or improvement, use the following key points:

  1. Feature Description: What is the feature about, and why does a user need it?

  2. User Tasks: What tasks can a user solve with this feature?

  3. Functionality: How does the feature work?

  4. Setup Requirements: How do you set it up? Are there any preconditions for it to work, such as existing setups or external configurations (e.g., what should be configured in a new Key Management Service - KMS)?

  5. Setup Steps: What are the setup steps? Explain the commands and parameters used in functions. Give examples of using them. Provide sample outputs for commands.

  6. Limitations and Breaking Changes: Are there any known limitations or breaking changes this feature introduces?

Edit documentation online via GitHub

  1. Click the Edit this page icon next to the page title. The source .md file of the page opens in GitHub editor in your browser. If you haven’t worked with the repository before, GitHub creates a fork of it for you.
  2. Edit the page. You can check your changes on the Preview tab.
  3. Commit your changes.
    • In the Commit changes section, describe your changes.
    • Select the Create a new branch for this commit and start a pull request option
    • Click Propose changes.
  4. GitHub creates a branch and a commit for your changes. It loads a new page on which you can open a pull request to Percona. The page shows the base branch - the one you offer your changes for, your commit message and a diff - a visual representation of your changes against the original page. This allows you to make a last-minute review. When you are ready, click the Create pull request button.
  5. Someone from our team reviews the pull request and if everything is correct, merges it into the documentation. Then it gets published on the site.

Edit documentation locally

This option is for users who prefer to work from their computer and / or have the full control over the documentation process.

The steps are the following:

  1. Fork this repository
  2. Clone the repository on your machine:
git clone --recursive [email protected]:<your-name>/postgres.git
  1. Change the directory to contrib/pg_tde and add the remote upstream repository:
git remote add upstream [email protected]:percona/postgres.git
  1. Pull the latest changes from upstream
git fetch upstream
  1. Create a separate branch for your changes
git checkout -b <PG-123-my_branch> upstream/release-2.3
  1. Make changes

  2. Commit your changes. The commit message guidelines will help you with writing great commit messages

  3. Open a pull request to Percona

Building the documentation

To verify how your changes look, generate the static site with the documentation. This process is called building. You can do it in these ways:

Use Docker
  1. Get Docker
  2. We use our Docker image to build documentation. Run the following command:
cd contrib/pg_tde/documentation
docker run --rm -v $(pwd):/docs perconalab/pmm-doc-md mkdocs build

If Docker can’t find the image locally, it first downloads the image, and then runs it to build the documentation.

  1. Go to the site directory and open the index.html file to see the documentation.

If you want to see the changes as you edit the docs, use this command instead:

cd contrib/pg_tde/documentation
docker run --rm -v $(pwd):/docs -p 8000:8000 perconalab/pmm-doc-md mkdocs serve --dev-addr=0.0.0.0:8000

Wait until you see INFO - Start detecting changes, then enter 0.0.0.0:8000 in the browser’s address bar. The documentation automatically reloads after you save the changes in source files.

Install MkDocs and build locally
  1. Install Python.

  2. Install MkDocs and required extensions:

    pip install -r requirements.txt
  3. Build the site:

    cd contrib/pg_tde/documentation
    mkdocs build
  4. Open site/index.html

Or, to run the built-in web server:

cd contrib/pg_tde/documentation
mkdocs serve

View the site at http://0.0.0.0:8000

Build PDF file

To build a PDF version of the documentation, do the following:

  1. Disable displaying the last modification of the page:

    export ENABLED_GIT_REVISION_DATE=false
  2. Build the PDF file:

    ENABLE_PDF_EXPORT=1 mkdocs build -f mkdocs-pdf.yml

    The PDF document is in the site/pdf folder.

PG.CENTER edition · Upstream source

21 - Get Help from Percona

Find community discussions, issue reporting, and Percona support channels.

This is the Percona pg_tde 2.3.0 manual. For the paired build, backup tools and major upgrades, see PG TDE on Mimus.

Our documentation guides are packed with information, but they can’t cover everything you need to know about pg_tde. They also won’t cover every scenario you might come across. Don’t be afraid to try things out and ask questions when you get stuck.

Percona’s Community Forum

Be a part of a space where you can tap into a wealth of knowledge from other database enthusiasts and experts who work with Percona’s software every day. While our service is entirely free, keep in mind that response times can vary depending on the complexity of the question. You are engaging with people who genuinely love solving database challenges.

We recommend visiting our Community Forum. It’s an excellent place for discussions, technical insights, and support around Percona database software. If you’re new and feeling a bit unsure, our FAQ and Guide for New Users ease you in.

If you have thoughts, feedback, or ideas, the community team would like to hear from you at Any ideas on how to make the forum better?. We’re always excited to connect and improve everyone’s experience.

Percona experts

Percona experts bring years of experience in tackling tough database performance issues and design challenges.

We understand your challenges when managing complex database environments. That’s why we offer various services to help you simplify your operations and achieve your goals.

ServiceDescription
24/7 Expert SupportOur dedicated team of database experts is available 24/7 to assist you with any database issues. We provide flexible support plans tailored to your specific needs.
Hands-On Database ManagementOur managed services team can take over the day-to-day management of your database infrastructure, freeing up your time to focus on other priorities.
Expert ConsultingOur experienced consultants provide guidance on database topics like architecture design, migration planning, performance optimization, and security best practices.
Comprehensive TrainingOur training programs help your team develop skills to manage databases effectively, offering virtual and in-person courses.

We’re here to help you every step of the way. Whether you need a quick fix or a long-term partnership, we’re ready to provide your expertise and support.

PG.CENTER edition · Upstream source

22 - Legal notice

The upstream AI chatbot notice, retained for reference; this site does not embed that service.

This is the Percona pg_tde 2.3.0 manual. For the paired build, backup tools and major upgrades, see PG TDE on Mimus.

Editorial correction

This is the notice for the upstream Percona AI chatbot. This independent documentation site does not embed that chatbot. See site errata.

You are interacting with an AI-powered chatbot that provides automated responses for general information about our IT services and software. Responses may be inaccurate or incomplete and do not constitute professional or contractual advice. Do not submit personal data, confidential information, credentials, or other sensitive information through this chat. Conversations may be logged and processed to improve our services in accordance with our Privacy Policy and applicable laws, including the GDPR. If you require assistance, please contact a human representative.

PG.CENTER edition · Upstream source

23 - Blog

Release notes, architecture notes, and operational guidance for pg_tde.

This is the Percona pg_tde 2.3.0 manual. For the paired build, backup tools and major upgrades, see PG TDE on Mimus.

Release notes, architecture explainers, and operational guidance derived from the pg_tde documentation.

PG.CENTER edition · Upstream source

23.1 - Release notes

Version announcements and focused upgrade notes for pg_tde.

This is the Percona pg_tde 2.3.0 manual. For the paired build, backup tools and major upgrades, see PG TDE on Mimus.

Version announcements and focused upgrade notes for pg_tde.

PG.CENTER edition · Upstream source

23.1.1 - pg_tde 2.2.2: Vault Enterprise KMIP and faster WAL encryption

What changed in pg_tde 2.2.2, which Percona PostgreSQL versions are compatible, and what operators should check before upgrading.

This is the Percona pg_tde 2.3.0 manual. For the paired build, backup tools and major upgrades, see PG TDE on Mimus.

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

pg_tde 2.2.2 focuses on two operator-facing changes: KMIP support for HashiCorp Vault Enterprise and better WAL encryption performance.

Warning

The upstream release notes state that pg_tde 2.2.2 is incompatible with Percona Distribution for PostgreSQL versions older than 17.10.2 or 18.4.2.

What changed

  • Add support for HashiCorp Vault Enterprise through KMIP. Vault Enterprise was already supported through the Vault V2 protocol.
  • Improve WAL encryption performance.
  • Fix empty certificate parameters passed to pg_tde_add_global_key_provider_kmip() and pg_tde_add_database_key_provider_kmip().
  • Fix a Vault provider race after a process fork.
  • Fix WAL archiving with pg_tde_archive_decrypt and pg_tde_restore_encrypt when pg_wal is a symlink.
  • Include frontend tool fixes from PostgreSQL 16.15, 17.11, and 18.5.

Before you upgrade

  1. Confirm the Percona PostgreSQL package version is compatible.
  2. Review the key provider configuration and ensure the server can read existing principal keys.
  3. Test WAL archive and restore in a disposable environment.
  4. Keep the backup and WAL encryption procedure with the change record.

For the complete upstream changelog, read the pg_tde 2.2.2 release note.

PG.CENTER edition · Upstream source

23.1.2 - pg_tde 2.2.1: PostgreSQL 16 support and safer rewind

The compatibility and reliability changes in pg_tde 2.2.1, with upgrade checks for operators.

This is the Percona pg_tde 2.3.0 manual. For the paired build, backup tools and major upgrades, see PG TDE on Mimus.

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

pg_tde 2.2.1 is a compatibility and reliability release.

Highlights

  • Add PostgreSQL 16 support.
  • Improve pg_rewind behavior for pg_tde clusters.
  • Fix the could not find server principal key error from pg_tde_basebackup.
  • Build pg_tde with Meson; the upstream release no longer supports building it with make.

Upgrade checks

Before upgrading, verify that the target Percona PostgreSQL package and the configured provider can read all existing principal keys. Test rewind, recovery, and backup restore in a staging cluster before changing a production primary.

Read the full 2.2.1 release note.

PG.CENTER edition · Upstream source

23.2 - Guides

Short, practical guides for designing and operating pg_tde deployments.

This is the Percona pg_tde 2.3.0 manual. For the paired build, backup tools and major upgrades, see PG TDE on Mimus.

Short, practical guides for designing and operating pg_tde deployments.

PG.CENTER edition · Upstream source

23.2.1 - A production checklist for pg_tde

The small set of installation, key custody, WAL, backup, and recovery checks to complete before enabling TDE in production.

This is the Percona pg_tde 2.3.0 manual. For the paired build, backup tools and major upgrades, see PG TDE on Mimus.

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

Before enabling encryption, make the key provider and recovery path as concrete as the database configuration.

Checklist

  • Confirm the Percona PostgreSQL and pg_tde versions are compatible.
  • Load pg_tde through shared_preload_libraries and create the extension in every database that needs it.
  • Use an external KMS or KMIP-compatible provider for production; keep keyring files for development and testing.
  • Create and verify a principal key before creating encrypted tables.
  • Test tde_heap on a new table and on a disposable copy of an existing table.
  • If WAL encryption is enabled, use the pg_tde-aware archive and restore tools.
  • Back up the provider configuration and document how the server obtains historical keys.
  • Test restore, replica creation, major upgrade, and provider outage procedures.
  • Record which objects are outside the encryption scope, including temporary files and statistics.

PG.CENTER edition · Upstream source

23.2.2 - 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.

This is the Percona pg_tde 2.3.0 manual. For the paired build, backup tools and major upgrades, see PG TDE on Mimus.

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

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

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

A table can be readable while its key provider is available and unreadable when the provider or credentials are missing. The key management guide and recovery limits belong in the same runbook as the database configuration.

PG.CENTER edition · Upstream source

23.3 - From the Percona blog

Original authors, publication dates and concise bilingual reading notes.

This is the Percona pg_tde 2.3.0 manual. For the paired build, backup tools and major upgrades, see PG TDE on Mimus.

Editorial notes and links to original Percona articles. Read the complete articles at the source.

PG.CENTER edition · Upstream source

23.3.1 - Questions from the PostgreSQL TDE webinar

The webinar follow-up discusses external key custody, table-level encryption, and the PostgreSQL patches required by pg_tde at the time. It is a useful starting point for separating data encryption from the surrounding access controls and recovery responsibilities.

This is the Percona pg_tde 2.3.0 manual. For the paired build, backup tools and major upgrades, see PG TDE on Mimus.

Original author: Michal Nosek · Published: 2025-08-13 · Source: Percona Blog. Reading note by PGSTY.

The webinar follow-up discusses external key custody, table-level encryption, and the PostgreSQL patches required by pg_tde at the time. It is a useful starting point for separating data encryption from the surrounding access controls and recovery responsibilities.

Read the complete Percona article.

Historical article

This article reflects its publication date. For current instructions, consult the related documentation and supported versions.

PG.CENTER edition · Upstream source

23.3.2 - The road to the pg_tde release candidate

The release-candidate announcement explains the move from tde_heap_basic to storage-manager integration and the redesign of WAL encryption. It captures a transition: table encryption was approaching GA, while WAL encryption remained a technology preview.

This is the Percona pg_tde 2.3.0 manual. For the paired build, backup tools and major upgrades, see PG TDE on Mimus.

Original author: Jan Wieremjewicz · Published: 2025-03-28 · Source: Percona Blog. Reading note by PGSTY.

The release-candidate announcement explains the move from tde_heap_basic to storage-manager integration and the redesign of WAL encryption. It captures a transition: table encryption was approaching GA, while WAL encryption remained a technology preview.

Read the complete Percona article.

Historical article

This article reflects its publication date. For current instructions, consult the related documentation and supported versions.

PG.CENTER edition · Upstream source

23.3.3 - An early look at pg_tde

This early project update invites testing of an experimental pg_tde and discusses checking whether a table is encrypted. Read it as project history: the access method and SQL interfaces have changed since this prototype.

This is the Percona pg_tde 2.3.0 manual. For the paired build, backup tools and major upgrades, see PG TDE on Mimus.

Original author: David Stokes · Published: 2024-01-30 · Source: Percona Blog. Reading note by PGSTY.

This early project update invites testing of an experimental pg_tde and discusses checking whether a table is encrypted. Read it as project history: the access method and SQL interfaces have changed since this prototype.

Read the complete Percona article.

Historical article

This article reflects its publication date. For current instructions, consult the related documentation and supported versions.

PG.CENTER edition · Upstream source

24 - About

Source, licence, and maintenance information for the pg_tde documentation site.

This is the Percona pg_tde 2.3.0 manual. For the paired build, backup tools and major upgrades, see PG TDE on Mimus.

This site combines the upstream pg_tde documentation with a bilingual Oink reading experience. See the attribution record.

PG.CENTER edition · Upstream source

24.1 - Attribution and copyright

Sources, copyright holders, licence texts and the scope of this independent documentation site.

This is the Percona pg_tde 2.3.0 manual. For the paired build, backup tools and major upgrades, see PG TDE on Mimus.

This is an independent documentation and translation site maintained by PGSTY. It is not Percona’s official documentation and does not imply Percona’s endorsement. The official documentation and upstream project remain the primary sources.

Documentation source

The English edition was updated on November 21, 2026 to pg_tde 2.3.0, at percona/pg_tde@5dd7a9e4e3599d88546f5de67ff0f4ef3fe51a9a. It adds the 2.3.0 release notes to the previously imported 66 articles, with section indexes and PGSTY editorial guides. The Chinese edition includes the reviewed 2.3.0 incremental changes. The original authors are Percona and the pg_tde contributors.

Read the source manifest for file paths, hashes, supporting assets, and pinned source URLs. Each adapted page links to its original. The errata records corrections checked against this snapshot.

Upstream copyright and licence

The repository’s COPYRIGHT contains the pg_tde licence, with PostgreSQL-style grants and warranty disclaimers. Its full, unmodified text is preserved in pg_tde-COPYRIGHT.txt. It names:

  • PostgreSQL Global Development Group — portions © 1996–2024.
  • The Regents of the University of California — portions © 1994.
  • Percona LLC and/or its affiliates — © 2024–2025.

The local identifier LicenseRef-pg-tde refers to that exact text. Permission covers use, copying, modification, and distribution of the software and its documentation subject to the stated notices and disclaimers. Percona and PostgreSQL names and logos remain the property of their respective holders.

Downstream work

PGSTY converts MkDocs formatting to Hugo/Oink, maintains paired English and Chinese pages, and adds navigation, an original key-hierarchy diagram, a homepage and editorial reading notes. SQL, examples and heading IDs are compared between languages. Corrections are disclosed separately; the source manifest retains the original hashes.

Percona blog entries are short editorial reading notes linking to the original articles. They retain the original author and publication date. The pg_tde repository licence is not asserted to cover the Percona website’s blog articles.

Site licence

The original standalone Percona documentation site’s configuration, styles, scripts, diagrams and original editorial text use the MIT License. Oink 1.5.1 supplies the theme under its own licence. Neither changes the upstream documentation licence.

PG.CENTER edition · Upstream source

24.2 - Documentation errata

Corrections made to the fixed pg_tde documentation snapshot.

This is the Percona pg_tde 2.3.0 manual. For the paired build, backup tools and major upgrades, see PG TDE on Mimus.

These corrections apply to the 1660e66a6a30 snapshot. They are downstream editorial changes, not an assertion that the upstream repository has merged them. Original files remain identifiable by the source manifest.

PageCorrectionEvidence
Functions and usage referenceUse pg_tde.inherit_global_providers; remove obsolete parameter names.GUC declarations
Functionspg_tde_set_key_using_global_key_provider sets the current database key. The separate server function sets the WAL key.Key implementation
Usage referenceServer/default key setters use global providers; the (global/database) notation is invalid for those two functions.SQL definitions
Restore tool%f is the WAL file name; %p is the destination for the unencrypted WAL segment.Built-in help
ReplicationCreate the principal key before assigning it as the server key.SQL definitions
FAQwork_mem spill files are not encrypted; ordinary VACUUM does not rotate a file’s internal key. Use a table rewrite such as VACUUM FULL.Limitations and architecture
Keyring exampleInspect customer_table, the table actually created; use pg_tde_key_info() for the current database key.Function reference
KMIP overviewPreserve the older verification wording but flag its difference from the 2.2.2 announcement of Vault Enterprise KMIP support.2.2.2 release notes

We also close a missing SQL quote, remove a duplicated RC changelog fragment, repair Markdown links and anchors, and replace MkDocs tabs/callouts with Oink components. Historical releases are labelled by their period. The upstream chatbot and feedback embed are not included.

The reproducible English transformations are recorded in scripts/import_upstream.py and scripts/upstream_edits.json; Chinese counterparts are maintained alongside them. Translation review is a self-review, not an independent certification or a runtime test of pg_tde.

PG.CENTER edition · Upstream source