Re: Proposal to Enable/Disable Index using ALTER INDEX (with patch)

From: Shayon Mukherjee <shayonj(at)gmail(dot)com>
To: Benoit Lobréau <benoit(dot)lobreau(at)gmail(dot)com>
Cc: Sami Imseih <samimseih(at)gmail(dot)com>, Michail Nikolaev <michail(dot)nikolaev(at)gmail(dot)com>, David Rowley <dgrowleyml(at)gmail(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, Peter Eisentraut <peter(at)eisentraut(dot)org>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Proposal to Enable/Disable Index using ALTER INDEX (with patch)
Date: 2025-02-01 07:41:00
Message-ID: CANqtF-puB7B5TAbZMibAMmWYzq+ak7WWJwZDkta7bBue8_bJSQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Jan 24, 2025 at 4:03 PM Benoit Lobréau <benoit(dot)lobreau(at)gmail(dot)com>
wrote:

> I did notice something in the command prototype:
>
> +ALTER INDEX [ IF EXISTS ] <replaceable
> class="parameter">name</replaceable> VISIBLE
> +ALTER INDEX [ IF EXISTS ] <replaceable
> class="parameter">name</replaceable> INVISIBLE
>
> it would probably be better as:
>
> +ALTER INDEX [ IF EXISTS ] <replaceable
> class="parameter">name</replaceable> {VISIBLE|INVISIBLE}
>
>
Thank you for your review, really appreciate it! I have updated with your
feedback in v10 patch [1]

> The completion for the INVISIBLE / VISIBLE keyword is missing in psql.
>
>
Also updated in v10 patch [1]

> Additionally, I tried using the ALTER command on an index that supports
> a foreign key. As expected, delete and update operations on the referenced
> table became significantly slower. I was wondering if this behavior should
> be documented here.
>
> + Make the specified index invisible. The index will not be used
> for queries.
> + This can be useful for testing query performance with and
> without specific
> + indexes.
>
> Maybe something like :
>
> The index will not be used for user or system queries (e.g., an index
> supporting foreign keys).
>
> I noticed that you mentionned checking pg_stat_user_indexes before using
> the query but it might not be enough?
>

This part of the documentation has gone through some changes, and I have
sensed it's hard to convey the details without complicating or breaking
precedence. By saying "The index will not be used for queries", I (as a
PostgreSQL user) was assuming this would apply to both user and system
queries, and hence the distinction was implicit. However, I don't have a
strong opinion and am happy to make the changes. I am also curious if
anyone else has thoughts on this as well?

[1]
https://www.postgresql.org/message-id/CANqtF-rs5N4ZepiH9YV1VVi6YNtyFDzDbJabhcZKqh-hNgLmgw%40mail.gmail.com

Thank you
Shayon

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Shayon Mukherjee 2025-02-01 07:44:10 Re: Proposal to Enable/Disable Index using ALTER INDEX (with patch)
Previous Message Shayon Mukherjee 2025-02-01 07:35:25 Re: Proposal to Enable/Disable Index using ALTER INDEX (with patch)