Naveen Yadav
Naveen Yadav

Reputation: 233

Postgres table queries not responding

I have been trying to truncate a table using SQlWorkbench. Suddenly, SqlWorkbench got freezed, while the truncate was in progress. I had to kill workbench from taskmanager. But now none of the queries are working on the table on which the truncate was aborted abruptly. For other tables queries are working fine. Need help, as I have to upload fresh data on the same table. Currently I am not even able to drop the table. What can be done to resolve this issue?

Upvotes: 2

Views: 7311

Answers (1)

Laurenz Albe
Laurenz Albe

Reputation: 246268

This looks like the TRUNCATE got stuck behind a lock, and then you killed the front end, while TRUNCATE kept running.

Connect to the database as superuser and examine the pg_stat_activity view; you should see some long running transactions.

Use the function pg_terminate_backend to kill these sessions by their pid.

Upvotes: 5

Related Questions