# Enabling encryption for whole database?

**URL:** <https://forums.percona.com/t/enabling-encryption-for-whole-database/28799>\
**Category:** PG\_TDE – Transparent Data Encryption (TDE)\
**Created:** [February 28, 2024, 3:15pm UTC](https://forums.percona.com/t/enabling-encryption-for-whole-database/28799 "2024-02-28T15:15:44Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tero\_Saarni](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/tero_saarni/32/15363_2.png) [@Tero\_Saarni](https://forums.percona.com/u/Tero_Saarni)\
**Post date:** [February 28, 2024, 3:15pm UTC](https://forums.percona.com/t/enabling-encryption-for-whole-database/28799/1 "2024-02-28T15:15:44Z")

</div>

Encryption is enabled by `CREATE TABLE ... USING pg_tde` in the examples. Is it possible to enable TDE globally for all tables in the database? Assume we do not have access to source code of the application that creates the tables, or would want to avoid changing the source code.

Thanks for making this extension! Eager to dig deeper into testing it! 🙂

---

<div class="post-metadata">

**Author:** ![Kai\_Wagner](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/kai_wagner/32/6286_2.png) [@Kai\_Wagner](https://forums.percona.com/u/Kai_Wagner)\
**Post date:** [February 28, 2024, 5:03pm UTC](https://forums.percona.com/t/enabling-encryption-for-whole-database/28799/2 "2024-02-28T17:03:39Z")

</div>

Hey,

happy to hear you do like our newest extension.

If you modify the default template, you can enable pg\_tde on every newly created database by default.

Documented here: [Set up - pg\_tde documentation](https://percona-lab.github.io/pg_tde/main/setup.html)

and the important part for you:

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

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

```

If you have any further questions, don’t hesitate to reach out.

Kai
