public inbox for [email protected]
help / color / mirror / Atom feedFrom: Michael Paquier <[email protected]>
To: Chao Li <[email protected]>
Cc: Corey Huinker <[email protected]>
Cc: Postgres hackers <[email protected]>
Cc: Tomas Vondra <[email protected]>
Subject: Re: Defects with invalid stats data for expressions in extended stats
Date: Mon, 2 Mar 2026 08:05:44 +0900
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
References: <[email protected]>
<CADkLM=c_3mPHr0JGP_72csQkpAt-v2fRN830RO8or1_R1qX2Wg@mail.gmail.com>
<[email protected]>
<[email protected]>
<[email protected]>
On Fri, Feb 27, 2026 at 04:33:24PM +0900, Michael Paquier wrote:
> On Fri, Feb 27, 2026 at 02:51:40PM +0800, Chao Li wrote:
>> Here stats itself is destroyed, but memory pointed by
>> stats[0]~stats[i-1] are not free-ed, those memory are returned from
>> examine_attribute() by palloc0_object().
>
> I am aware of that. This is not done on simplicity ground, keeping
> the cleanup of the memory context to ANALYZE in this case.
About this one, something worth noting is the beginning of
do_analyze_rel(), which does the following:
/*
* Set up a working context so that we can easily free whatever junk gets
* created.
*/
anl_context = AllocSetContextCreate(CurrentMemoryContext,
"Analyze",
ALLOCSET_DEFAULT_SIZES);
caller_context = MemoryContextSwitchTo(anl_context);
So these extra allocations would just be freed under this memory
context umbrella once we are done processing a single relation. This
works even if we begin to repeat ANALYZE commands that fail to build
some of the stats in a repeated fashion in a single transaction block.
Code simplicity and readability is just a better choice for this path.
--
Michael
Attachments:
[application/pgp-signature] signature.asc (833B, ../[email protected]/2-signature.asc)
download
view thread (11+ messages) latest in thread
reply
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: [email protected]
Cc: [email protected], [email protected], [email protected], [email protected], [email protected]
Subject: Re: Defects with invalid stats data for expressions in extended stats
In-Reply-To: <[email protected]>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox