Validate Encryption with 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.
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
Create a table in the database for which you have enabled
pg_tdeusing thetde_heapaccess method as follows:Warning: Example for testing purposes only:
Learn more about table access methods and how you can enable data encryption by default in the Table Access Methods and TDE section.
To check if the data is encrypted, run the following function:
The function returns
trueorfalse.(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:
Using SET ACCESS METHOD drops hint bits which can impact query performance. To restore performance, run:
This forces PostgreSQL to check every tuple for visibility and reset the hint bits.
Want to remove encryption later? See how to decrypt your data.