Re: Should pg 11 use a lot more memory building an spgist index? - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Should pg 11 use a lot more memory building an spgist index?
Date
Msg-id 15917.1541020889@sss.pgh.pa.us
Whole thread Raw
In response to Re: Should pg 11 use a lot more memory building an spgist index?  (Amit Langote <Langote_Amit_f8@lab.ntt.co.jp>)
Responses Re: Should pg 11 use a lot more memory building an spgist index?
List pgsql-hackers
Amit Langote <Langote_Amit_f8@lab.ntt.co.jp> writes:
> Maybe, we don't need to spoil the interface of index_beginscan with the
> new memory context argument like my patch does if the simple following of
> its contract by amendscan would suffice.

Yeah, I'm not enamored of changing the API of index_beginscan for this;
the existing convention that it should allocate in CurrentMemoryContext
seems perfectly suitable.  And changing it would create a lot of code
churn, not only for us but for externally-maintained AMs.

What is at stake is changing the API of amendscan, to specify that it
need not release memory because the current context is expected to be
destroyed or reset shortly after ending the scan.  Then, for the small
number of call sites where that wouldn't be true, it's on those callers
to set up a suitable context and switch into it.  Note this is actually
forwards compatible, in that an AM that's still following the convention
of releasing stuff manually would not be broken.

            regards, tom lane


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Parallel threads in query
Next
From: David Rowley
Date:
Subject: Re: PostgreSQL Limits and lack of documentation about them.