DROP INVALID INDEXES command

From: Roman Khapov <rkhapov(at)yandex-team(dot)ru>
To: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: DROP INVALID INDEXES command
Date: 2026-06-30 10:22:58
Message-ID: 60D96A6C-56BD-4FAC-BB34-B85443298877@yandex-team.ru
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi hackers!

Recently Kirill and I have faced several problems with
pg_repack, that resulted in list of invalid indexes on our installations,
and that required us to remove them ourselves.

We thought that it might be useful to have a command in PG, that
removes invalid indexes on specified table automatically, to reduce
the chances of any human-related mistakes. So we implemented a new
command which usage looks like:

postgres=# drop invalid indexes on table sas;
NOTICE: dropping index "idx2"
NOTICE: dropping index "idx5"
DROP INVALID INDEXES
postgres=#

We would like to know if this feature would be acceptable
for upstream inclusion.
POC patch attached, any feedback on the design and implementation is welcome :)

--
Best regards,
Roman Khapov

Attachment Content-Type Size
0001-Add-DROP-INVALID-INDEXES-ON-TABLE-command.patch application/octet-stream 13.2 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message wenhui qiu 2026-06-30 10:25:09 WAL compression setting after PostgreSQL LZ4 default change
Previous Message Christoph Berg 2026-06-30 10:19:21 Re: [PATCH] Document wal_compression=on