From: | Shayon Mukherjee <shayonj(at)gmail(dot)com> |
---|---|
To: | Sami Imseih <samimseih(at)gmail(dot)com> |
Cc: | 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-01-12 19:58:14 |
Message-ID: | CANqtF-oCAe97_ufOrL2wpXHfj17aO6ocZfxY5sYgWHXyODWKEA@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Sat, Jan 11, 2025 at 5:50 PM Sami Imseih <samimseih(at)gmail(dot)com> wrote:
> Here is a use-case where the GUC may be useful. I can see a user
> wanting to try out the index before committing to using it across the
> board. They can create the index as invisible and force using
> it in a specific part of the application. If they are happy with the
> results,
> they can make it visible. This is similar to but not exactly what HypoPG
> [1]
> does. HypoPG does not actually create the index and can only be used
> with EXPLAIN ( not EXPLAIN ANALYZE ) in a specific session. I see the
> ability to test on a real index may be more useful. Maybe others have
> other thoughts on this?
>
>
That's a good call out, thank you. I was mostly interested in the other use
cases and I like how this bool GUC unlocks the use case you mentioned.
Plus, also the ability to conditionally use indexes in session that are
globally marked as invisible.
> > I agree. DISABLE doesn't sit right. I noticed INVISIBLE in MariaDB. I
> like HIDDEN/VISIBLE or ACTIVE/INACTIVE as well, since it impacts query
> planning.
>
> Let's see if other have an opinion on this, but VISIBLE/INVISIBLE
> seem the best way to indicate that the indexes are visible or invisible
> from the optimizer. ACTIVE/INACTIVE sound a lot like ENABLE/DISABLE.
>
I like VISIBLE/INVISIBLE. Proposing a new patch with the following changes
- We now have moved away from DISABLE/ENABLE grammar to VISIBLE/INVISIBLE.
No change in functionality, it's all the same as before, just new grammar.
Backed by regression specs like before too.
- The column in pg_index is now called indisvisible.
- Introduced a new GUC - use_invisible_index. When set to on, it will not
respect the visibility state in pg_index (related to the above
conversation).
- When GUC is assigned/updated we accordingly reset plan cache. Backed this
specs with.
The patch is rebased against master and passes in CI. Happy to iterate on
any feedback received.
Thanks
Shayon
Attachment | Content-Type | Size |
---|---|---|
v9-0001-Introduce-the-ability-to-set-index-visibility-usi.patch | application/octet-stream | 61.9 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Alena Rybakina | 2025-01-12 20:38:35 | Re: POC, WIP: OR-clause support for indexes |
Previous Message | Tom Lane | 2025-01-12 19:21:07 | Re: pgsql: Consolidate docs for vacuum-related GUCs in new subsection |