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_cn_5001_3_2_3795
pg_toast_temp_cn_5001_3_2_3795
(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.