Create index removal procedure
Create a procedure that, given a table name, will drop all of its indexes. Use this procedure during retention maintenance and also document its usefulness outside of pg_partman.
What is purpose of dropping indexes by default?
If anyone moves¹ retention tables to an archive via dump/restore, this function will do a disservice.
Getting an index deletion DDL is a one-line query (and can be wrapped to be executed in DO command²). It is better to document how to do it instead of perform it.
— ¹ Otherwise why to leave them? ² https://www.postgresql.org/docs/current/sql-do.html
I made no mention of this being a default action. This is just to provide a procedure to make it easier to do if desired.
Oops… Sorry.
I thought it will be default because of phrase "Use this procedure during retention maintenance" without conditions.
O:-)
No problem. Index removal is already part of retention maintenance. Was just a note for myself to make sure I got back and use the new code there.