-
Notifications
You must be signed in to change notification settings - Fork 285
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Regarding run_maintenance_proc() with concurrently option for detaching tables #677
Comments
CONCURRENT operations in PostgreSQL cannot be run within an explicit transactions (manual call of BEGIN/END). All functions and procedures run as explicit transactions, so you cannot call any CONCURRENT operation within them. Therefore, there is no way for any pg_partman function within the database to provide concurrent drops. This does bring up a possible idea to write a python script as has been done for some other pg_partman functions (https://github.com/pgpartman/pg_partman/tree/master/bin/common). Using that sort of method or any other method to connect and run the DROP CONCURRENTLY command is the only way I can think of to do so. I'm not sure when I will have the time to do so in the near future, but I can leave this issue open as a feature request to look into it. Be happy to accept a PR to review as well if you implement a python script like this. |
I think this is doable from inside the DB, but am concerned that using dblink to perform the detach as part of maintenance runs the risk of a deadlock. The Just throwing ideas out here, maybe |
The pg_jobmon extension that pg_partman can use for monitoring does this trick to allow autonomous transactions to keep function steps logged during a rollback. I'd rather not go the dblink route in partman since that would require having to maintain some other configuration that contains the dblink credentials. I think the python script method would be what I'd accept at this point since partman already has precedent for doing such scripts for things that cannot be run inside functions. |
Hi
With pg_partman we know the use case .By default run_maintenance_proc() does not detach tables concurrently. How do we implement tables detach concurrently without blocking other sessions
We need to detach child tables with concurrently option to ensure that detach to be happened without skipping when running queries on parent table based on the retention policy as here some of the queries not using date column which in turn to scan all available child tables
There would be no problem while detaching tables if queries using date column
The text was updated successfully, but these errors were encountered: