After postgresql drop table space is not released

After the database to perform drop table XXX, see du -sh has dropped, but df -h / pgdb not been reduced, there is a process using the corresponding file handle

 

1. Make sure the file ID by table name

select pg_relation_filepath('table_name');

2. Make sure to use the file ID of whether the process can be deleted

lsof |  grep “文件ID”

select *
from pg_stat_activity
where pid="PID”

3. Delete the corresponding process

select pg_terminate_backend('PID');

 4. The database table corresponding to the drop

1
drop table table_name;

Reprinted from: https://www.cnblogs.com/xyz0601/p/10448702.html

 

Guess you like

Origin www.cnblogs.com/xibuhaohao/p/11426166.html