Showing results for 
Search instead for 
Did you mean: 

LOG: autovacuum: found orphan temp table "pg_temp_<NNN>."<>" in database "<database name>"

Sometimes DBA experience that the database logs start filling with the messages as below

LOG:  autovacuum: found orphan temp table "pg_temp_<NNN>."<>" in database "<database name>"

The important part of that message is it's a "LOG" not FATAL or ERROR message

The above message can appear in the database log if the application which created this PID closed the connection/terminated abnormally that
will leave the orphan objects if that connection was using the temp tables during that period. Or if the database was stopped abnormally [any crash occurred].

****But those temp tables will not interfere with ongoing transactions**** 

This will be resolved when the database reaches near the value of 2 billion transactions and autovacuum drops those unwanted temp

tables. However, for avoiding the database logs getting filled with the unwanted messages as a workaround, the remnants can be safely dropped using the command drop schema  pg_temp_NNN cascade; eg:  DROP SCHEMA pg_temp_123 cascade;"  

Version history
Revision #:
1 of 1
Last update:
‎05-10-2019 09:22 AM
Updated by:
Labels (1)