Trying to consolidate the main questions here as below.
2)As we are using pg_partman for maintaining the partitions, So do we need to schedule multiple crons (one for parent table and other for child table), so that first it will drop the child table partition and then the parent table partition(As because detaching/dropping parent partition first will error out) called in order? OR only one cron job call like below can do the job for us and make sure the dependency between the tables is taken care of automatically?
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 maintaining the foreign key intact?
2)As we are using pg_partman for maintaining the partitions, So do we need to schedule multiple crons (one for parent table and other for child table), so that first it will drop the child table partition and then the parent table partition(As because detaching/dropping parent partition first will error out) called in order? OR only one cron job call like below can do the job for us and make sure the dependency between the tables is taken care of automatically?
SELECT cron.schedule('@daily',partman.run_maintenance());