Why would a SQL drop statement give a timeout
I am trying 开发者_如何学运维to drop some tables in a Postgres database. For some of those table I am getting 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 a primary key and both object_1_id and object_2_id are foreign key.
Now the table is empty and I want to drop it. Both Drop and Truncate are giving me transation timeout. I have been able to drop it and my other postgres environnements. The timeout is after 30 seconds.
Check pg_locks and pg_stat_activity to see if the table is still in use by some proces.
精彩评论