Help Center/ GaussDB/ Developer Guide(Centralized_V2.0-8.x)/ FAQ/ What Is the Schema Starting with pg_temp or pg_toast_temp?
Updated on 2025-05-29 GMT+08:00

What Is the Schema Starting with pg_temp or pg_toast_temp?

Answer: When you query the schemas, the query result contains schemas starting with pg_temp or pg_toast_temp, as shown in the following information.

gaussdb=# SELECT nspname FROM pg_namespace WHERE nspname LIKE 'pg_t%' AND nspname != 'pg_toast';
             nspname             
---------------------------------
 pg_temp_dn_6001_4_1_11495
 pg_toast_temp_dn_6001_4_1_11495
(2 rows)

Tables starting with pg_temp or pg_toast_temp are created when temporary tables are created. The schema starting with pg_temp in each session is visible only to the current session. Therefore, you are advised not to manually delete schemas starting with pg_temp or pg_toast_temp during routine operations.

Temporary tables are visible only in the current session and are automatically deleted after the session ends. The corresponding schemas are also deleted.