Postgres truncate slow

In postgres 9.2 (CentOS), the TRUNCATE TABLE command took a lot of time from time to time. Once it took more than 1.5 hours to trim a table with 100 KB records, even longer in other cases. This problem also occurred when I used pgAdmin to trim the table. What is the possible reason? and how to improve truncation performance?

The server has 16 GB of memory and shared_buffers = 1536MB

+4
source share
2 answers

TRUNCATEshould clear shared_buffersfor a truncated table and disable the old file, which may slow down on file systems with slow deletion, for example ext3.

1,5 , . , , , TRUNCATE. . pg_catalog.pg_locks pg_catalog.pg_stat_activity.

Wiki PostgreSQL .

: Postgresql

+9

. 58000 .

, postgres PyCharm DB Navigator, dev- .. 118 .

0

All Articles