Remove IndexInfo.ii_OpclassOptions field

Lists: pgsql-hackers
From: Peter Eisentraut <peter(at)eisentraut(dot)org>
To: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Remove IndexInfo.ii_OpclassOptions field
Date: 2023-08-24 06:57:58
Message-ID: f84640e3-00d3-5abd-3f41-e6a19d33c40b@eisentraut.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Lists: pgsql-hackers

During some refactoring I noticed that the field
IndexInfo.ii_OpclassOptions is kind of useless. The IndexInfo struct is
notionally an executor support node, but this field is not used in the
executor or by the index AM code. It is really just used in DDL code in
index.c and indexcmds.c to pass information around locally. For that,
it would be clearer to just use local variables, like for other similar
cases. With that change, we can also remove
RelationGetIndexRawAttOptions(), which only had one caller left, for
which it was overkill.

Attachment Content-Type Size
0001-Remove-IndexInfo.ii_OpclassOptions-field.patch text/plain 10.6 KB
0002-Remove-unused-include.patch text/plain 728 bytes
0003-Remove-RelationGetIndexRawAttOptions.patch text/plain 3.0 KB

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Peter Eisentraut <peter(at)eisentraut(dot)org>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Remove IndexInfo.ii_OpclassOptions field
Date: 2023-08-25 01:31:09
Message-ID: ZOgEXTOa7Je/O9A6@paquier.xyz
Views: Whole Thread | Raw Message | Download mbox | Resend email
Lists: pgsql-hackers

On Thu, Aug 24, 2023 at 08:57:58AM +0200, Peter Eisentraut wrote:
> During some refactoring I noticed that the field IndexInfo.ii_OpclassOptions
> is kind of useless. The IndexInfo struct is notionally an executor support
> node, but this field is not used in the executor or by the index AM code.
> It is really just used in DDL code in index.c and indexcmds.c to pass
> information around locally. For that, it would be clearer to just use local
> variables, like for other similar cases. With that change, we can also
> remove RelationGetIndexRawAttOptions(), which only had one caller left, for
> which it was overkill.

I am not so sure. There is a very recent thread where it has been
pointed out that we have zero support for relcache invalidation with
index options, causing various problems:
https://www.postgresql.org/message-id/CAGem3qAM7M7B3DdccpgepRxuoKPd2Y74qJ5NSNRjLiN21dPhgg%40mail.gmail.com

Perhaps we'd better settle on the other one before deciding if the
change you are proposing here is adapted or not.
--
Michael


From: Peter Eisentraut <peter(at)eisentraut(dot)org>
To: Michael Paquier <michael(at)paquier(dot)xyz>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Remove IndexInfo.ii_OpclassOptions field
Date: 2023-08-29 08:51:10
Message-ID: 38128793-278d-7cb2-5bcf-8a7849e23e98@eisentraut.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Lists: pgsql-hackers

On 25.08.23 03:31, Michael Paquier wrote:
> On Thu, Aug 24, 2023 at 08:57:58AM +0200, Peter Eisentraut wrote:
>> During some refactoring I noticed that the field IndexInfo.ii_OpclassOptions
>> is kind of useless. The IndexInfo struct is notionally an executor support
>> node, but this field is not used in the executor or by the index AM code.
>> It is really just used in DDL code in index.c and indexcmds.c to pass
>> information around locally. For that, it would be clearer to just use local
>> variables, like for other similar cases. With that change, we can also
>> remove RelationGetIndexRawAttOptions(), which only had one caller left, for
>> which it was overkill.
>
> I am not so sure. There is a very recent thread where it has been
> pointed out that we have zero support for relcache invalidation with
> index options, causing various problems:
> https://www.postgresql.org/message-id/CAGem3qAM7M7B3DdccpgepRxuoKPd2Y74qJ5NSNRjLiN21dPhgg%40mail.gmail.com
>
> Perhaps we'd better settle on the other one before deciding if the
> change you are proposing here is adapted or not.

Ok, I'll wait for the resolution of that.

At a glance, however, I think my patch is (a) not related, and (b) if it
were, it would probably *help*, because the change is to not allocate
any long-lived structures that no one needs and that might get out of date.


From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Peter Eisentraut <peter(at)eisentraut(dot)org>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Remove IndexInfo.ii_OpclassOptions field
Date: 2023-08-30 00:51:23
Message-ID: ZO6Si98LzksTgxmP@paquier.xyz
Views: Whole Thread | Raw Message | Download mbox | Resend email
Lists: pgsql-hackers

On Tue, Aug 29, 2023 at 10:51:10AM +0200, Peter Eisentraut wrote:
> At a glance, however, I think my patch is (a) not related, and (b) if it
> were, it would probably *help*, because the change is to not allocate any
> long-lived structures that no one needs and that might get out of date.

Hmm, yeah, perhaps you're right about (b) here. I have a few other
high-priority items for stable branches on my board before being able
to look at all this in more details, unfortunately, so feel free to
ignore me if you think that this is an improvement anyway even
regarding the other issue discussed.
--
Michael


From: Peter Eisentraut <peter(at)eisentraut(dot)org>
To: Michael Paquier <michael(at)paquier(dot)xyz>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Remove IndexInfo.ii_OpclassOptions field
Date: 2023-10-03 15:56:08
Message-ID: 06370f1c-ce6a-6a04-7d7c-72fbd081ea25@eisentraut.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Lists: pgsql-hackers

On 30.08.23 02:51, Michael Paquier wrote:
> On Tue, Aug 29, 2023 at 10:51:10AM +0200, Peter Eisentraut wrote:
>> At a glance, however, I think my patch is (a) not related, and (b) if it
>> were, it would probably *help*, because the change is to not allocate any
>> long-lived structures that no one needs and that might get out of date.
>
> Hmm, yeah, perhaps you're right about (b) here. I have a few other
> high-priority items for stable branches on my board before being able
> to look at all this in more details, unfortunately, so feel free to
> ignore me if you think that this is an improvement anyway even
> regarding the other issue discussed.

I have committed this.