Re: When Update balloons memory

From: Peter Geoghegan <pg(at)bowt(dot)ie>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Klaudie Willis <Klaudie(dot)Willis(at)protonmail(dot)com>, PostgreSQL mailing lists <pgsql-bugs(at)lists(dot)postgresql(dot)org>
Subject: Re: When Update balloons memory
Date: 2022-01-11 19:45:19
Message-ID: CAH2-Wzk=5jGMdS4UWmQJ9m3YQGot9K5ZcBqCQ-_J55rjK7MHAA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-general

On Tue, Dec 14, 2021 at 11:33 AM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> I'd be inclined to do so if we can find a suitable place to put it.
> But wouldn't a field in IndexInfo serve? Letting the field default
> to "not optimizable" would cover most cases.

Attached draft HEAD-only bugfix adds two new bool fields to IndexInfo.
The first bool indicates if we've already done the required work for
this IndexInfo. The second field is used as a cache (if the cache is
set the first bool is 'true'). These two fields fit in existing
alignment padding, so the marginal space overhead is zero.

I'll probably need to greatly simplify the code for backpatch, to
avoid an ABI break. Seems fine to teach index_unchanged_by_update to
return "true" unconditionally, given how the IndexUnchanged hint is
currently applied.

I haven't made the code use pull_varnos(), which you suggested back in
December. It looks like it would be tricky to do that from the
executor, since pull_varnos() has a PlannerInfo* argument. That has
been the case since your commit 55dc86eca7 from January 2021, "Fix
pull_varnos' miscomputation of relids set for a PlaceHolderVar".
Please advise.

--
Peter Geoghegan

Attachment Content-Type Size
v1-0001-Fix-memory-leak-in-indexUnchanged-hint-mechanism.patch application/octet-stream 5.2 KB

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2022-01-11 19:54:28 Re: When Update balloons memory
Previous Message PG Bug reporting form 2022-01-11 10:46:41 BUG #17362: Error "could not find block containing chunk" when using index with icu collation on CentOS 7

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2022-01-11 19:54:28 Re: When Update balloons memory
Previous Message Adrian Klaver 2022-01-11 17:22:30 Re: DROP OWNED BY fails with #53200: ERROR: out of shared memory