Why does SQL drop statement time out

I am trying to delete some tables in a Postgres database. For some of these tables, I get a transaction timeout (even where they are empty).

This is my table.

CREATE TABLE many_2_many_table (
id integer NOT NULL,
object_1_id integer NOT NULL,
object_2_id integer NOT NULL);

id is the primary key and both objects object_1_id and object_2_id are a foreign key.

Now the table is empty and I want to drop it. Both Drop and Truncate give me redirection time. I was able to drop it and other postgres environments. Timeout after 30 seconds.

+3
source share
1 answer

Check pg_locks and pg_stat_activity to see that the table is still in use by some processes.

+6
source

Source: https://habr.com/ru/post/1792611/


All Articles