目录
环境
系统平台:N/A
版本:4.1.1
症状
/xxx/data/base/pgsql_tmp 该文件夹下,临时文件数量及体积快速增加。重启数据库会使临时文件被删除,一段时间后临时文件再次出现爆满的情况。
问题原因
执行复杂SQL未能正常结束,导致产生的临时文件未自动删除,临时文件数量和体积增加占用了大量磁盘空间。
解决方案
根据文件的命名方式,通过pid查询产生临时文件的SQL。
-rw------- 1 highgo highgo 3.7M 5月 14 16:09 pgsql_tmp2542.0 -rw------- 1 highgo highgo 19M 5月 14 16:09 pgsql_tmp2456.0 -rw------- 1 highgo highgo 16M 5月 14 16:09 pgsql_tmp2541.0 -rw------- 1 highgo highgo 152M 5月 14 16:09 pgsql_tmp2534.1 -rw------- 1 highgo highgo 270M 5月 14 16:09 pgsql_tmp2484.1 -rw------- 1 highgo highgo 90M 5月 14 16:09 pgsql_tmp2463.1 -rw------- 1 highgo highgo 144M 5月 14 16:09 pgsql_tmp2459.1 -rw------- 1 highgo highgo 165M 5月 14 16:09 pgsql_tmp2532.1 -rw------- 1 highgo highgo 192M 5月 14 16:09 pgsql_tmp2524.1 -rw------- 1 highgo highgo 98M 5月 14 16:09 pgsql_tmp2461.1 [highgo@localhost pgsql_tmp]$ du -sh pgsql_tmp2484.1 387M pgsql_tmp2484.1 [highgo@localhost pgsql_tmp]$ du -sh pgsql_tmp2524.1 359M pgsql_tmp2524.1 highgo=# select * from pg_stat_activity where pid='2484'; -[ RECORD 1 ]----+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ datid | 16386 datname | test pid | 2484 usesysid | 16384 usename | test application_name | PostgreSQL JDBC Driver client_hostname | client_port | 42366 backend_start | 2019-05-14 16:06:34.475507+08 xact_start | 2019-05-14 16:06:48.812548+08 query_start | 2019-05-14 16:06:48.814563+08 state_change | 2019-05-14 16:06:48.814565+08 waiting | f state | active backend_xid | backend_xmin | 29879732 query | SELECT XXX; highgo=# select * from pg_stat_activity where pid='2524'; -[ RECORD 1 ]----+------------------------------------------------------------------------- |
等多解决方案请登录【瀚高技术支持平台】 查看https://support.highgo.com/#/index/docContent/a5a443f501d1cd2e