pg_partman icon indicating copy to clipboard operation
pg_partman copied to clipboard

Create index removal procedure

Open keithf4 opened this issue 2 years ago • 4 comments

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.

keithf4 avatar Mar 22 '23 19:03 keithf4

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

vitaly-burovoy avatar Jun 30 '23 16:06 vitaly-burovoy

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.

keithf4 avatar Jun 30 '23 16:06 keithf4

Oops… Sorry.

I thought it will be default because of phrase "Use this procedure during retention maintenance" without conditions.

O:-)

vitaly-burovoy avatar Jul 02 '23 08:07 vitaly-burovoy

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.

keithf4 avatar Jul 02 '23 18:07 keithf4