From: Burd, Greg <gregburd@amazon.com>
To: Matthias van de Meent <boekewurm+postgres@gmail.com>
Cc: pgsql-hackers@postgresql.org <pgsql-hackers@postgresql.org>
Subject: Re: Expanding HOT updates for expression and partial indexes
Date: Thu, 6 Mar 2025 12:22:58 +0000
Message-ID: <13E47BD7-D4EF-4BEC-BFD4-D7625E7283C5@amazon.com> (raw)
In-Reply-To: <CAEze2WjUjf2yB48vB9RP-C=ZKibO2XPEb4+zTj3pPJZOa9M+Ng@mail.gmail.com>
References: <78574B24-BE0A-42C5-8075-3FA9FA63B8FC@amazon.com>
<CAEze2WjjOg+gE1VUZ2Omd-26MniaY6-UJghqzLZMHpVkDEUy8w@mail.gmail.com>
<DBA06D41-32C8-45D5-A3FA-15A412692351@amazon.com>
<CAEze2WgyAUtW64eP8uxZmHUy-RfBtuiKaUybvi=Jc3bwgg3g4Q@mail.gmail.com>
<EA519A89-282D-4535-88C6-C79588FF1DA8@amazon.com>
<CAEze2WjCJokQbBOQqK0qJFw0H=cu27XB=hrgQOhy9TQ=41RPmg@mail.gmail.com>
<238EEE41-B206-4590-8C20-DA52C25A2291@amazon.com>
<CAEze2WjUjf2yB48vB9RP-C=ZKibO2XPEb4+zTj3pPJZOa9M+Ng@mail.gmail.com>
> On Mar 5, 2025, at 5:56 PM, Matthias van de Meent <boekewurm+postgres@gmail.com> wrote:
>
> Hi,
>
> Sorry for the delay. This is a reply for the mail thread up to 17 Feb,
> so it might be very out-of-date by now, in which case sorry for the
> noise.
Never noise, always helpful.
> On Mon, 17 Feb 2025 at 20:54, Burd, Greg <gregburd@amazon.com> wrote:
>> On Feb 15, 2025, at 5:49 AM, Matthias van de Meent <boekewurm+postgres@gmail.com> wrote:
>>>
>>> In HEAD, we have a clear indication of which classes of indexes to
>>> update, with TU_UpdateIndexes. With this patch, we have to derive that
>>> from the (lack of) bits in the bitmap that might be output by the
>>> table_update procedure.
>>
>> Yes, but... that "clear indication" is lacking the ability to convey more detailed information. It doesn't tell you which summarizing indexes really need updating just that as a result of being on the HOT path all summarizing indexes require updates.
>
> Agreed that it's not great if you want to know about which indexes
> were meaningfully updated. I think that barring significant advances
> in performance of update checks, we can devise a way of transfering
> this info to the table_tuple_update caller once we get a need for more
> detailed information (e.g. this could be transfered through the
> IndexInfo* that's currently also used by index_unchanged_by_update).
One idea I had and tested a bit was to re-order the arrays of ri_IndexRelationInfo/Desc[] and then have a ri_NumModifiedIndices. This avoided allocation of a Bitmapset and was something downstream code could use or not depending on the requirements within that path. It may be, and I didn't check, that the order of indexes in that array has meaning in other contexts in the code so I put this aside. I think I'll keep focused as much as possible and consider that within the context of another patch later if needed.
>>> I think we can do with an additional parameter for which indexes would
>>> be updated (or store that info in the parameter which also will hold
>>> EState et al). I think it's cheaper that way, too - only when
>>> update_indexes could be TU_SUMMARIZING we might need the exact
>>> information for which indexes to insert new tuples into, and it only
>>> really needs to be sized to the number of summarizing indexes (usually
>>> small/nonexistent, but potentially huge).
>>
>> Okay, yes with this patch we need only concern ourselves with all, none, or some subset of summarizing as before. I'll work on the opaque parameter next iteration.
>
> Thanks!
I still haven't added the opaque parameter as suggested, but it's on my mind to give it a shot.
>>> -----
>>>
>>> I don't see a good reason to add IndexInfo to Relation, by way of
>>> rd_indexInfoList. It seems like an ad-hoc way of passing data around,
>>> and I don't think that's the right way.
>>
>> At one point I'd created a way to get this set via relcache, I will resurrect that approach but I'm not sure it is what you were hinting at.
>
> AFAIK, we don't have IndexInfo in the relcaches currently. I'm very
> hesitant to add an executor node (!) subtype to catalog caches, as
> IndexInfos are also used to store temporary information about e.g.
> index tuple insertion state, which (if IndexInfo is stored in
> relcaches) would imply modifying relcache entries without any further
> locks, and I'm not sure that's at all an OK thing to do.
This is gone in the v10 patch in favor of finding IndexInfo within the EState's ri_IndexRelationInfo[].
Thanks again for your continued support!
-greg
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-hackers@postgresql.org
Cc: gregburd@amazon.com, boekewurm+postgres@gmail.com
Subject: Re: Expanding HOT updates for expression and partial indexes
In-Reply-To: <13E47BD7-D4EF-4BEC-BFD4-D7625E7283C5@amazon.com>
References: <78574B24-BE0A-42C5-8075-3FA9FA63B8FC@amazon.com> <CAEze2WjjOg+gE1VUZ2Omd-26MniaY6-UJghqzLZMHpVkDEUy8w@mail.gmail.com> <DBA06D41-32C8-45D5-A3FA-15A412692351@amazon.com> <CAEze2WgyAUtW64eP8uxZmHUy-RfBtuiKaUybvi=Jc3bwgg3g4Q@mail.gmail.com> <EA519A89-282D-4535-88C6-C79588FF1DA8@amazon.com> <CAEze2WjCJokQbBOQqK0qJFw0H=cu27XB=hrgQOhy9TQ=41RPmg@mail.gmail.com> <238EEE41-B206-4590-8C20-DA52C25A2291@amazon.com> <CAEze2WjUjf2yB48vB9RP-C=ZKibO2XPEb4+zTj3pPJZOa9M+Ng@mail.gmail.com> <13E47BD7-D4EF-4BEC-BFD4-D7625E7283C5@amazon.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox