没有 active/idle 会话仍然存在于 postgresql 中的临时文件

no active/idle session still temporary files present in postgresql

我使用下面的查询来找出 postgresql-9.6 实例中存在的临时文件

SELECT datname, temp_files AS "Temporary files",temp_bytes AS "Size of temporary files" FROM pg_stat_database 
order by temp_bytes desc;

结果如下

为什么 Postgresql 在没有活动会话时维护临时表?

您误解了这些数字是什么。它们是数据库生命周期内的总数。它们不是当前存在的临时文件的编号。