2

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?

1
  • You can try query pg_stat_activity and check whether the truncate command still running or not. Commented Feb 14, 2018 at 9:13

1 Answer 1

5

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.

Sign up to request clarification or add additional context in comments.

1 Comment

how exaclty do you call pg_stat_activity?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.