From: | Peter Eisentraut <peter(at)eisentraut(dot)org> |
---|---|
To: | Shayon Mukherjee <shayonj(at)gmail(dot)com>, pgsql-hackers(at)lists(dot)postgresql(dot)org |
Subject: | Re: Proposal to Enable/Disable Index using ALTER INDEX |
Date: | 2024-09-23 15:14:15 |
Message-ID: | 15238d97-f667-48df-8319-ab73b37d4511@eisentraut.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On 09.09.24 23:38, Shayon Mukherjee wrote:
> *Problem*:
> Adding and removing indexes is a common operation in PostgreSQL. On
> larger databases, however, these operations can be resource-intensive.
> When evaluating the performance impact of one or more indexes, dropping
> them might not be ideal since as a user you may want a quicker way to
> test their effects without fully committing to removing & adding them
> back again. Which can be a time taking operation on larger tables.
>
> *Proposal*:
> I propose adding an ALTER INDEX command that allows for enabling or
> disabling an index globally. This could look something like:
>
> ALTER INDEX index_name ENABLE;
> ALTER INDEX index_name DISABLE;
>
> A disabled index would still receive updates and enforce constraints as
> usual but would not be used for queries. This allows users to assess
> whether an index impacts query performance before deciding to drop it
> entirely.
I think a better approach would be to make the list of disabled indexes
a GUC setting, which would then internally have an effect similar to
enable_indexscan, meaning it would make the listed indexes unattractive
to the planner.
This seems better than the proposed DDL command, because you'd be able
to use this per-session, instead of forcing a global state, and even
unprivileged users could use it.
(I think we have had proposals like this before, but I can't find the
discussion I'm thinking of right now.)
From | Date | Subject | |
---|---|---|---|
Next Message | Magnus Holmgren | 2024-09-23 15:38:43 | restrict_nonsystem_relation_kind led to regression (kinda) |
Previous Message | Zhang Mingli | 2024-09-23 15:13:57 | Re: Remove useless GROUP BY columns considering unique index |