This is the multi-page printable view of this section.
Overview
- 1: About Transparent Data Encryption
- 2: How pg_tde works
- 3: Benefits of pg_tde
- 4: Encrypted data scope
- 5: Table access methods and pg_tde
- 6: Impact of pg_tde on database operations
- 7: Supported PostgreSQL deployments
- 8: Limitations of 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.
1 - About Transparent Data 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.
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
2 - How pg_tde works
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.
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:

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.
3 - Benefits of 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.
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.
You can find more information on Transparent Data Encryption (TDE) in this article.
4 - Encrypted data scope
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.
5 - Table access methods and 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.
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:
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
CREATEstatement will default to the specified table access method. - You must create the
pg_tdeextension 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:
Add the access method to the
default_table_access_methodparameter:Use
ALTER SYSTEM, it requires superuser orALTER SYSTEMprivileges.Edit the
postgresql.confconfiguration file and add the value for thedefault_table_access_methodparameter.You can use the SET command to change the default table access method temporarily, for the current session.
Unlike modifying the
postgresql.conffile or using theALTER SYSTEMcommand, the changes you make via theSETcommand don’t persist after the session ends.You also don’t need to have the superuser privileges to run the
SETcommand.You can run the SET command anytime during the session.
Reload the configuration to apply the changes:
6 - Impact of pg_tde on database operations
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.
| Area | Affected | Notes / Actions |
|---|---|---|
| Backups | ❌ Yes | Encrypted backups require pg_tde-aware tools. See Backup with WAL encryption. |
| Restore | ❌ Yes | Restored data remains encrypted; pg_tde transparently handles decryption. See Restore encrypted backups. |
| Streaming replication | ⚠️ Partial | Replicas 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 | ✅ No | Not affected. |
| Monitoring and statistics | ✅ No | Not affected, including pg_stat_monitor. |
| Performance | ⚠️ Slight | Minor CPU overhead due to enabling encryption, most noticeable on random write workloads. |
7 - Supported PostgreSQL deployments
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_heapaccess 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.
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.
8 - Limitations of 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.
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
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_memare 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
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
pg_tdeThe 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_createsubscriberpg_receivewalBarmanpg_verifybackupby 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_decryptandpg_tde_restore_encrypt, or witharchive-async,archive-header-check, orchecksum-pageenabled.
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=streamor--wal-method=none), for details on usingpg_tde_basebackupwith WAL encryption, see Backup with WAL encryption enabledpg_tde_resetwalpg_tde_rewindpg_tde_upgradepg_tde_waldump- pgBackRest, when
pg_tde_archive_decryptandpg_tde_restore_encryptare configured andarchive-async,archive-header-check, andchecksum-pageare disabled
Example Patroni configuration
The following is a Percona-tested example configuration.
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.