Re: Not able to purge partition

2024-04-02 Thread Laurenz Albe
On Tue, 2024-04-02 at 01:41 +0530, sud wrote: > On Thu, Mar 21, 2024 at 6:18 PM Laurenz Albe wrote: > > > [create some partitions, then drop a partition of the referenced table] > > > > > > SQL Error [P0001]: ERROR: cannot drop table > > > schema1.test_part_drop_parent_p2024_02_01 because other

Re: Not able to purge partition

2024-04-01 Thread sud
On Thu, Mar 21, 2024 at 6:18 PM Laurenz Albe wrote: > > > [create some partitions, then drop a partition of the referenced table] > > > > > SQL Error [P0001]: ERROR: cannot drop table > schema1.test_part_drop_parent_p2024_02_01 because other objects depend on it > > CONTEXT: SQL statement "DROP

Re: Not able to purge partition

2024-03-25 Thread Laurenz Albe
On Mon, 2024-03-25 at 02:54 +0530, veem v wrote: > Can you please suggest some docs which shows the way we should > do the partition maintenance (if not using pg_partman)? man cron > Actually , I am not able to visualize the steps here. Do you mean > to say , we will just create the partition

Re: Not able to purge partition

2024-03-24 Thread veem v
On Sun, 24 Mar 2024 at 20:29, Laurenz Albe wrote: > On Sun, 2024-03-24 at 00:37 +0530, veem v wrote: > > > Instead, use foreign keys between the partitions. > > > > I am struggling to understand how to maintain those partitions then? > > As because we were planning to use pg_partman for creating

Re: Not able to purge partition

2024-03-24 Thread Laurenz Albe
On Sun, 2024-03-24 at 00:37 +0530, veem v wrote: > > Instead, use foreign keys between the partitions. > > I am struggling to understand how to maintain those partitions then? > As because we were planning to use pg_partman for creating and dropping > partitions automatically without much hassle.

Re: Not able to purge partition

2024-03-24 Thread Lok P
On Sun, Mar 24, 2024 at 12:38 AM veem v wrote: > On Sat, 23 Mar 2024 at 23:08, Laurenz Albe > wrote: > >> On Sat, 2024-03-23 at 22:41 +0530, veem v wrote: >> > 1)As we see having foreign key defined is making the detach partition >> run >> > for minutes(in our case 5-10minutes for 60 million

Re: Not able to purge partition

2024-03-23 Thread veem v
On Sat, 23 Mar 2024 at 23:08, Laurenz Albe wrote: > On Sat, 2024-03-23 at 22:41 +0530, veem v wrote: > > 1)As we see having foreign key defined is making the detach partition run > > for minutes(in our case 5-10minutes for 60 million rows partition), so > > how to make the parent table

Re: Not able to purge partition

2024-03-23 Thread Laurenz Albe
On Sat, 2024-03-23 at 22:41 +0530, veem v wrote: > 1)As we see having foreign key defined is making the detach partition run > for minutes(in our case 5-10minutes for 60 million rows partition), so > how to make the parent table partition detach and drop work fast in such > a scenario while

Re: Not able to purge partition

2024-03-23 Thread veem v
Trying to consolidate the main questions here as below. 1)As we see having foreign key defined is making the detach partition run for minutes(in our case 5-10minutes for 60 million rows partition), so how to make the parent table partition detach and drop work fast in such a scenario while

Re: Not able to purge partition

2024-03-21 Thread veem v
Can someone please confirm if this behavior of foreign key is expected with the partition created through partman extension and thus we need to have our manual process written for partition purge (in order of child first and then parent) , rather relying on partman partition maintenance to take

Re: Not able to purge partition

2024-03-21 Thread veem v
On Thu, 21 Mar 2024 at 23:39, Laurenz Albe wrote: > On Thu, 2024-03-21 at 22:50 +0530, veem v wrote: > > So when you mentioned "to create the foreign keys *not* between the > > partitioned table but between the individual partitions" , can that > > be done using the same "partman.create_parent"

Re: Not able to purge partition

2024-03-21 Thread Laurenz Albe
On Thu, 2024-03-21 at 22:50 +0530, veem v wrote: > So when you mentioned "to create the foreign keys *not* between the > partitioned table but between the individual partitions" , can that > be done using the same "partman.create_parent" procedure and automated > cron job schedule or has to be

Re: Not able to purge partition

2024-03-21 Thread veem v
On Thu, 21 Mar, 2024, 6:18 pm Laurenz Albe, wrote: What you *can* do is detach the partition and then drop it, but detatching will be slow because PostgreSQL has to check for referencing rows. The best solution is to create the foreign key *not* between the partitioned tables, but between the

Re: Not able to purge partition

2024-03-21 Thread gparc
- Mail original - > De: "Laurenz Albe" > À: "veem v" , "pgsql-general" > > Envoyé: Jeudi 21 Mars 2024 13:48:19 > Objet: Re: Not able to purge partition > On Thu, 2024-03-21 at 11:07 +0530, veem v wrote: >> CREATE TABLE schema1.t

Re: Not able to purge partition

2024-03-21 Thread Laurenz Albe
On Thu, 2024-03-21 at 11:07 +0530, veem v wrote: > CREATE TABLE schema1.test_part_drop_parent > ( >  c1 varchar(36)  NOT NULL , >  c2_part_date timestamp with time zone  NOT NULL , >  c3  numeric(12,0)  NOT NULL , >  CONSTRAINT test_part_drop_parent_PK PRIMARY KEY (c1,c2_part_date) > ) PARTITION

Re: Not able to purge partition

2024-03-21 Thread veem v
Also, i see, its not allowing to drop the parent table partition even all the respective child partitions are dropped and no child record exists in the child table. But this started working , when we detach parent partition and then drop the partitions. So it means if we just change the setup of