跳转到主要内容

pg_tde

Percona pg_tde access method

pg_tde : Percona pg_tde access method

Overview

ID Extension Package Version Category License Language
7500 pg_tde pg_tde 2.2.2 SEC MIT C
Attribute Has Binary Has Library Need Load Has DDL Relocatable Trusted
--sLd-- No Yes Yes Yes no no
Percona PostgreSQL 18.6 only; requires preload.

Packages

Type Repo Version PG Major Compatibility Package Pattern Dependencies
EXT PIGSTY 2.2.2 18 17 16 15 14 pg_tde -
RPM PIGSTY 18.6 18 17 16 15 14 pgtde-$v -
DEB PIGSTY 18.6 18 17 16 15 14 pgtde-$v -
Linux / PG PG18 PG17 PG16 PG15 PG14
el8.x86_64 PIGSTY 18.6 N/A N/A N/A N/A
el8.aarch64 PIGSTY 18.6 N/A N/A N/A N/A
el9.x86_64 PIGSTY 18.6 N/A N/A N/A N/A
el9.aarch64 PIGSTY 18.6 N/A N/A N/A N/A
el10.x86_64 PIGSTY 18.6 N/A N/A N/A N/A
el10.aarch64 PIGSTY 18.6 N/A N/A N/A N/A
d12.x86_64 PIGSTY 18.6 N/A N/A N/A N/A
d12.aarch64 PIGSTY 18.6 N/A N/A N/A N/A
d13.x86_64 PIGSTY 18.6 N/A N/A N/A N/A
d13.aarch64 PIGSTY 18.6 N/A N/A N/A N/A
u22.x86_64 PIGSTY 18.6 N/A N/A N/A N/A
u22.aarch64 PIGSTY 18.6 N/A N/A N/A N/A
u24.x86_64 PIGSTY 18.6 N/A N/A N/A N/A
u24.aarch64 PIGSTY 18.6 N/A N/A N/A N/A
u26.x86_64 PIGSTY 18.6 N/A N/A N/A N/A
u26.aarch64 PIGSTY 18.6 N/A N/A N/A N/A
Package Version OS ORG SIZE File URL
pgtde-18 18.6 el8.x86_64 pigsty 21.9 MiB pgtde-18-18.6-1PGSTY.el8.x86_64.rpm
pgtde-18 18.6 el8.aarch64 pigsty 21.4 MiB pgtde-18-18.6-1PGSTY.el8.aarch64.rpm
pgtde-18 18.6 el9.x86_64 pigsty 20.6 MiB pgtde-18-18.6-1PGSTY.el9.x86_64.rpm
pgtde-18 18.6 el9.aarch64 pigsty 20.3 MiB pgtde-18-18.6-1PGSTY.el9.aarch64.rpm
pgtde-18 18.6 el10.x86_64 pigsty 20.7 MiB pgtde-18-18.6-1PGSTY.el10.x86_64.rpm
pgtde-18 18.6 el10.aarch64 pigsty 20.4 MiB pgtde-18-18.6-1PGSTY.el10.aarch64.rpm
pgtde-18 18.6 d12.x86_64 pigsty 20.3 MiB pgtde-18_18.6-1PGSTY~bookworm_amd64.deb
pgtde-18 18.6 d12.aarch64 pigsty 19.8 MiB pgtde-18_18.6-1PGSTY~bookworm_arm64.deb
pgtde-18 18.6 d13.x86_64 pigsty 18.7 MiB pgtde-18_18.6-1PGSTY~trixie_amd64.deb
pgtde-18 18.6 d13.aarch64 pigsty 18.2 MiB pgtde-18_18.6-1PGSTY~trixie_arm64.deb
pgtde-18 18.6 u22.x86_64 pigsty 22.1 MiB pgtde-18_18.6-1PGSTY~jammy_amd64.deb
pgtde-18 18.6 u22.aarch64 pigsty 21.8 MiB pgtde-18_18.6-1PGSTY~jammy_arm64.deb
pgtde-18 18.6 u24.x86_64 pigsty 20.5 MiB pgtde-18_18.6-1PGSTY~noble_amd64.deb
pgtde-18 18.6 u24.aarch64 pigsty 20.2 MiB pgtde-18_18.6-1PGSTY~noble_arm64.deb
pgtde-18 18.6 u26.x86_64 pigsty 20.2 MiB pgtde-18_18.6-1PGSTY~resolute_amd64.deb
pgtde-18 18.6 u26.aarch64 pigsty 19.9 MiB pgtde-18_18.6-1PGSTY~resolute_arm64.deb

Source

percona-postgresql-18.6.tar.gz percona-pg_tde18-2.2.2.tar.gz pgtde-pg-config percona-postgis-3.5.7.tar.gz percona-pgvector_18-0.8.6.tar.gz percona-wal2json-2.6.tar.gz percona-pg_repack-1.5.3.tar.gz percona-pgaudit-18.0.tar.gz percona-pgaudit18_set_user-4.2.0.tar.gz percona-pg-stat-monitor18-2.3.2.tar.gz percona-pg_gather-33.tar.gz pgtde-sfcgal-config

pig build pkg pg_tde;		# build rpm/deb

Install

Make sure PGDG and PIGSTY repo available:

pig repo add pgsql -u   # add both repo and update cache

Install this extension with pig:

pig install pg_tde;		# install via package name, for the active PG version

pig install pg_tde -v 18;   # install for PG 18

Config this extension to shared_preload_libraries:

shared_preload_libraries = 'pg_tde';

Create this extension with:

CREATE EXTENSION pg_tde;

Usage

Sources:

pg_tde provides transparent data encryption for Percona Server for PostgreSQL. It encrypts table data through the tde_heap access method and can encrypt WAL, with keys managed by file, HashiCorp Vault, or KMIP providers. It is not a drop-in extension for community PostgreSQL.

Preload and Create the Extension

Add the library and restart the server:

shared_preload_libraries = 'pg_tde'

Then enable pg_tde in every database that will use encrypted tables:

CREATE EXTENSION pg_tde;

Run setup as a superuser or suitably privileged database owner. Upstream pg_tde 2.2 is tied to compatible Percona Server for PostgreSQL 17 or 18 builds; the 2.2.0 release notes warn that it is incompatible with Percona Distribution releases older than 17.10 and 18.4.

Configure a Key Provider

Register a provider, then set a principal key. A local file provider is useful for evaluation:

SELECT pg_tde_add_database_key_provider_file(
  'local-file',
  '/secure/path/pg_tde_keys'
);

SELECT pg_tde_set_principal_key(
  'app-principal-key',
  'local-file'
);

For production, upstream recommends an external provider such as Vault or KMIP rather than the local-file provider. Protect provider credentials, key files, backups, and recovery procedures independently of the database files.

Provider management includes database- and server-global variants for file, Vault, and KMIP providers, plus functions to list, change, and delete providers and to inspect or rotate the principal key.

Create and Convert Encrypted Tables

Create a table with the encrypted access method:

CREATE TABLE customer_secrets (
  id bigint GENERATED ALWAYS AS IDENTITY PRIMARY KEY,
  payload jsonb NOT NULL
) USING tde_heap;

Convert an existing table only after testing lock, rewrite, disk-space, and backup implications:

ALTER TABLE customer_secrets SET ACCESS METHOD tde_heap;

Changing a table access method rewrites the table. Plan maintenance time and confirm indexes, replicas, backups, and restores on a staging copy.

Enable WAL Encryption

WAL encryption is a separate server setting:

pg_tde.wal_encrypt = on

Changing it requires a restart. Confirm that every primary, standby, backup, archive, and recovery host has the required provider configuration and key access before enabling it.

Object Index

  • tde_heap: encrypted table access method.
  • pg_tde_add_database_key_provider_file/vault/kmip: database-scoped provider registration.
  • pg_tde_add_global_key_provider_file/vault/kmip: server-global provider registration.
  • pg_tde_set_principal_key and pg_tde_set_server_principal_key: select the key used to protect data-encryption keys.
  • pg_tde_list_all_key_providers: inspect registered providers.
  • pg_tde_change_key_provider_* and pg_tde_delete_key_provider: manage provider definitions.
  • pg_tde.wal_encrypt: enable encryption of write-ahead log records.
  • pg_tde_upgrade: upgrade helper introduced in the 2.2 line.

Security and Recovery Boundaries

  • pg_tde encrypts supported user-table storage, not every PostgreSQL artifact. System catalogs, planner statistics, and temporary spill files are among the documented exclusions.
  • Upstream warns that pg_rewind and pg_tde_rewind between diverged nodes can corrupt a cluster. Follow the documented rebuild/recovery path instead of assuming ordinary rewind is safe.
  • Starting recovery without pg_tde preloaded can corrupt encrypted data. Validate disaster-recovery automation with the library and keys present.
  • Percona documents incompatibilities with Citus and TimescaleDB in Percona Server and limitations for several WAL-inspection and recovery tools.
  • Encryption does not replace SQL privileges, TLS, host hardening, audit logging, or tested backups. Loss of keys can make otherwise intact backups unrecoverable.