Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1szYoy-006gMM-8M for pgsql-hackers@arkaria.postgresql.org; Sat, 12 Oct 2024 09:54:00 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1szYow-000U65-3F for pgsql-hackers@arkaria.postgresql.org; Sat, 12 Oct 2024 09:53:58 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1szYov-000U5r-NV for pgsql-hackers@lists.postgresql.org; Sat, 12 Oct 2024 09:53:58 +0000 Received: from mail-ej1-x635.google.com ([2a00:1450:4864:20::635]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1szYor-000efU-UP for pgsql-hackers@lists.postgresql.org; Sat, 12 Oct 2024 09:53:57 +0000 Received: by mail-ej1-x635.google.com with SMTP id a640c23a62f3a-a99f3a5a44cso20472666b.3 for ; Sat, 12 Oct 2024 02:53:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1728726834; x=1729331634; darn=lists.postgresql.org; h=references:to:cc:in-reply-to:date:subject:mime-version:message-id :from:from:to:cc:subject:date:message-id:reply-to; bh=3ryiPofzQweRVNIdzeyRPdOUHv3wAdGIOPlwFQRjcX8=; b=c+EPHbwMz8uyJvjQZ0NJajXGOcrMrACG6Y+uXeWAfOeGtxNN5As2muyXaO/GNX6BKp ksKK6Jx99/3hwnLWPwH472QLiDDf5kc/a6MAlQkSgog3phx4B3Gk3nrFOZ66+1gz4azM oRuc4wj1kzNZqZmqxcuRS/jkPgQGw57dYdwJsHyxVH1I0qwZTh0EJHSAus7GuLqoNuUN CKTgh5z1CM8U5w2i5OLxFRy0Wh0Nx/iNT7F97jvxmU3XcyJ6xufEavn52FYE8TOPTqZX 6gU0uFn6qMipMPO9wF5fmVtYMwJnUFc2tffzB7CKVrrzfcwm7kjEXrdMnrnkwy+LW+Mj 0ZKQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728726834; x=1729331634; h=references:to:cc:in-reply-to:date:subject:mime-version:message-id :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=3ryiPofzQweRVNIdzeyRPdOUHv3wAdGIOPlwFQRjcX8=; b=tDm2/o7pd4lpNkp3pWjoi6LaQe64Clrd5jGqkxXwOwS6M6NQWGlI/02mVWPGmo4gr0 twBPEl+gtnoHcI7uwF6K0N4Xn1KJp2WkSdyqwAe3TSzSorkMIvqvAuh4L4H/5lpXbEya ztWurkNvOoONXBfymdfdDs/TtCNmKHONo4rMdA9WT/xEkdTSK3psNJb403YT1GrrEBf4 BcTE3HyZ07tng/XApqpRrj3qFQHJiGpCRTpZkYsYCygUSMjARihvo57jC1IgksHIRbwr WDZqAIKNv4yjfnN1xikD4I1FSzr8j+0rN+j7rTX6KJUpwg2S+rKHSXzXEpLNMAVAzJA9 x2xg== X-Forwarded-Encrypted: i=1; AJvYcCWM5J5UmqagVn53/FyvmgNgopnK4w9kfJykC9fkk+rtq3wBl1W82XOny2VWTnBkTIio5vvYDaAolr6WjiQz@lists.postgresql.org X-Gm-Message-State: AOJu0Yz1If9xDOv97MakUJANSwzOJDaDWQY0LQyfU3KwYIiDVUqIkep+ rCyF+NX7ephKiFec0HVRkKUOFRjdtcPOFlu+Ev9qHQYHtkcBpOgO X-Google-Smtp-Source: AGHT+IEsVu3+XxAjBTs1SWFaMOIDHBPawR7iBzQLaTx+W0iqhQtBfAZsBfqKqmrkJTW8wVpod/Fp/A== X-Received: by 2002:a17:907:d3e6:b0:a93:c2b0:f965 with SMTP id a640c23a62f3a-a99b9583ac7mr430121666b.41.1728726833554; Sat, 12 Oct 2024 02:53:53 -0700 (PDT) Received: from smtpclient.apple ([89.101.60.19]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5c93711c105sm2706281a12.40.2024.10.12.02.53.51 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 12 Oct 2024 02:53:52 -0700 (PDT) From: Shayon Mukherjee Message-Id: Content-Type: multipart/alternative; boundary="Apple-Mail=_6C4AC98D-5A1E-4FAA-AEEB-F90FC34C9DFC" Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3731.300.101.1.3\)) Subject: Re: Proposal to Enable/Disable Index using ALTER INDEX Date: Sat, 12 Oct 2024 10:53:42 +0100 In-Reply-To: Cc: Robert Haas , Peter Eisentraut , pgsql-hackers@lists.postgresql.org To: David Rowley References: <15238d97-f667-48df-8319-ab73b37d4511@eisentraut.org> <31040EAB-AB69-466C-A41B-B34EB6324150@gmail.com> X-Mailer: Apple Mail (2.3731.300.101.1.3) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --Apple-Mail=_6C4AC98D-5A1E-4FAA-AEEB-F90FC34C9DFC Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 Hi David,=20 Answered below > On Oct 9, 2024, at 9:19 AM, David Rowley wrote: >=20 > On Wed, 9 Oct 2024 at 20:07, Shayon Mukherjee = wrote: >> [thinking=E2=80=A6] Unless - we try to do support both a GUC and the = ALTER INDEX ENABLE/DISABLE grammar + isdisabled attribute on pg_index? >=20 > I just wanted to explain my point of view on this. This is my opinion > and is by no means authoritative. >=20 > I was interested in this patch when you proposed it as an ALTER INDEX > option. I know other committers seem interested, but I personally > don't have any interest in the GUC option. I think the reason I > dislike it is that it's yet another not even half-baked take on > planner hints (the other one being enable* GUCs). I often thought that > if we ever did planner hints that it would be great to have multiple > ways to specify the hints. Ordinarily, I'd expect some special comment > type as the primary method to specify hints, but equally, it would be > nice to be able to specify them in other ways. e.g. a GUC to have them > apply to more than just 1 query. Useful for things such as "don't use > index X". Thank you so much this context, as someone new to psql-hackers, having = this insight is super useful. Also getting a sense of how folks feel = about controlling different behaviors like planner hints through GUC and = SQL grammar. =20 For instance: I wasn=E2=80=99t quite able to figure out the how to = properly distinguish + reason between the enable* GUCs and ALTER index = for this case, and patches are per my limited understand of the = historical context as well. =20 >=20 > Now, I'm not suggesting you go off and code up planner hints. That's a > huge project. I'm just concerned that we've already got a fair bit of > cruft that will be left remaining if we ever get core planner hints > and a disabled_indexes GUC will just add to that. I don't feel like > the ALTER INDEX method would be leftover cruft from us gaining core > planner hints. Others might feel differently on that one. I feel the > ALTER INDEX option is less controversial. >=20 > I'll also stand by what I said earlier on this thread. If PeterG gets > index skip scans done for PG18, then it's likely there's going to be > lots of users considering if they still need a certain index or not > after upgrading to PG18. Likewise, I personally feel that the ability to disable indexes quickly = and reverse the disabling (also quickly) is super useful, especially = from an operational POV (point of view). So, I am very keen on getting = this landed and happy to iterate on as many patches as it takes. :D At this point, I am indifferent to each of the approaches (GUC or SQL = grammar) based on the pros/cons I shared earlier in the thread & = discussions in the thread. However, I would like us to make progress on = getting _something_ out since the topic of disabling indexes has come up = many times on pgsql-hackers in the past years and there is no easy way = to toggle this behavior yet.=20 =E2=80=9Cyet another not even half-baked take on planner hints" is a = good way to put things about enable* GUCs, so I am very much on board = with proposing an updated PATCH to support disabling of indexes through = ALTER. The original PATCH was here for context [1].=20 I am also curious about supporting this ([1]) through the ALTER grammar = and not having the planner consider indexes by updating = `get_relation_info` in `plancat.c`. Basically, through = `pg_index.isdisabled`, which is already open in `get_relation_info`, we = can read from `pg_index.isdisabled` and accordingly update = `IndexOptInfo.isdisabled`. So, I'm happy to explore that as well and = share my findings.=20 [1] = https://www.postgresql.org/message-id/CANqtF-oBaBtRfw9O7GAoHN3nNEZQYsW3oaG= fD%2BwJfG8R29nZYw%40mail.gmail.com Thanks Shayon --Apple-Mail=_6C4AC98D-5A1E-4FAA-AEEB-F90FC34C9DFC Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8 Hi = David, 

Answered below

On Oct 9, 2024, at 9:19 AM, David Rowley = <dgrowleyml@gmail.com> wrote:

On Wed, 9 Oct 2024 at = 20:07, Shayon Mukherjee <shayonj@gmail.com> wrote:
[thinking=E2=80=A6] Unless - we try to do support both a = GUC and the ALTER INDEX ENABLE/DISABLE grammar + isdisabled attribute on = pg_index?

I just wanted to explain my point of view = on this.  This is my opinion
and is by no means = authoritative.

I was interested in this patch when you proposed = it as an ALTER INDEX
option. I know other committers seem interested, = but I personally
don't have any interest in the GUC option.  I = think the reason I
dislike it is that it's yet another not even = half-baked take on
planner hints (the other one being enable* GUCs). = I often thought that
if we ever did planner hints that it would be = great to have multiple
ways to specify the hints. Ordinarily, I'd = expect some special comment
type as the primary method to specify = hints, but equally, it would be
nice to be able to specify them in = other ways. e.g. a GUC to have them
apply to more than just 1 query. = Useful for things such as "don't use
index = X".

Thank you so much this = context, as someone new to psql-hackers, having this insight is super = useful. Also getting a sense of how folks feel about controlling = different behaviors like planner hints through GUC and SQL grammar. =  

For instance: I wasn=E2=80=99t quite = able to figure out the how to properly distinguish + reason =  between the enable* GUCs and ALTER index for this case, and = patches are per my limited understand of the historical context as = well.
  

Now, I'm not suggesting you go off and code = up planner hints. That's a
huge project. I'm just concerned that = we've already got a fair bit of
cruft that will be left remaining if = we ever get core planner hints
and a disabled_indexes GUC will just = add to that. I don't feel like
the ALTER INDEX method would be = leftover cruft from us gaining core
planner hints. Others might feel = differently on that one. I feel the
ALTER INDEX option is less = controversial.

I'll also stand by what I said earlier on this = thread. If PeterG gets
index skip scans done for PG18, then it's = likely there's going to be
lots of users considering if they still = need a certain index or not
after upgrading to = PG18.


Likew= ise, I personally feel that the ability to disable indexes quickly and = reverse the disabling (also quickly) is super useful, especially from an = operational POV (point of view). So, I am very keen on getting this = landed and happy to iterate on as many patches as it takes. = :D

At this point, I am indifferent to each of = the approaches (GUC or SQL grammar) based on the pros/cons I shared = earlier in the thread & discussions in the thread. However, I would = like us to make progress on getting _something_ out since the topic of = disabling indexes has come up many times on pgsql-hackers in the past = years and there is no easy way to toggle this behavior = yet. 

=E2=80=9Cyet another not even = half-baked take on planner hints" is a good way to put things about = enable* GUCs, so I am very much on board with proposing an updated PATCH = to support disabling of indexes through ALTER. The original PATCH was = here for context [1]. 

I am also curious = about supporting this ([1]) through the ALTER grammar and not having the = planner consider indexes by updating `get_relation_info` in `plancat.c`. = Basically, through `pg_index.isdisabled`, which is already open in = `get_relation_info`, we can read from `pg_index.isdisabled` and = accordingly update `IndexOptInfo.isdisabled`. So, I'm happy to explore = that as well and share my = findings. 



Thanks
Shayon

<= /body>= --Apple-Mail=_6C4AC98D-5A1E-4FAA-AEEB-F90FC34C9DFC--