From: Tom Lane <tgl@sss.pgh.pa.us>
To: Amit Langote <Langote_Amit_f8@lab.ntt.co.jp>
Cc: Amit Langote <amitlangote09@gmail.com>
Cc: Alvaro Herrera <alvherre@2ndquadrant.com>
Cc: akorotkov@postgresql.org, bruno@wolff.to, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Subject: Re: Should pg 11 use a lot more memory building an spgist index?
Date: Wed, 31 Oct 2018 17:21:29 -0400
Message-ID: <15917.1541020889@sss.pgh.pa.us> (raw)
In-Reply-To: <c0af0e01-7c0d-370f-d5a5-a74596b08eee@lab.ntt.co.jp>
References: <20181026140927.oh4gd367st47li6h@alvherre.pgsql>
<26004.1540563602@sss.pgh.pa.us>
<20752.1540842517@sss.pgh.pa.us>
<f7da983e-e489-3f05-5446-48812c8e35fc@lab.ntt.co.jp>
<CA+HiwqEYqPsNnxYUDL6J=CJJnzOz-S_pJ4EJt+-hX0cDf1q4OA@mail.gmail.com>
<c0af0e01-7c0d-370f-d5a5-a74596b08eee@lab.ntt.co.jp>
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
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 using the --to and --cc options:
reply via email
To: pgsql-general@postgresql.org
Cc: tgl@sss.pgh.pa.us, Langote_Amit_f8@lab.ntt.co.jp, amitlangote09@gmail.com, alvherre@2ndquadrant.com, pgsql-hackers@lists.postgresql.org
Subject: Re: Should pg 11 use a lot more memory building an spgist index?
In-Reply-To: <15917.1541020889@sss.pgh.pa.us>
* 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