I’m creating a new partition for every second deliberately in order to faster
reproduce a bug I have on the live environment. In the live environment a new
partitions are being created every one day. More to that, we create new
partitions in advance and this procedure is only a backup mechanisum
It looks like you are creating a partition for each minute of the day (when
logs get inserted for a given minute at least). Would it be at all
reasonable to have an hourly or daily job which creates the partitions
ahead of when they are actually needed? If partitions went unused in the
recent past,
Hi Andrei
General speaking any DDL (Create, Alter Drop .etc) commands issue
exclusive locks automatically, so anything this transaction touches starts
getting exclusive locks. Assuming this is a multi-threading app these two
threads are sending commands all but at the same time. The Exclusive
Hi, Justin
I’ve managed to reproduce this deadlock (different threads) and it looks it
happens while Postgres tries to insert data into unique index for pg_type table
(it creates a new row-type for every new table and a new partition is a new
table). 16453 is old of the parent's table for the p
Hi Andrei,
My gut reactions is Yes this is a deadlock caused by a race condition, the
error from psycopg2 tells us that. Question becomes what is causing these
two process to collide, are both processes 33 and 37 python code, As both
are trying to access the same resource 16453 i would assume
I think that I’ve got a deadlock (which is handled by `exception when others`
statements). But the problem is it occurs too fast. Is it possible to get a
deadlock faster than deadlock_timeout? It’s set to 1s (default value) but it
looks like I get it immidiately. Error message I’m getting after
We use this code in order to automatically create new partitions for a
partitioned table (Postgres 10.6):
begin
insert into ;
exception when undefined_table then
begin
-- A concurrent txn has created the new partition
exception when others then end;
-- Insert data into the ne