public inbox for [email protected]  
help / color / mirror / Atom feed
From: Chao Li <[email protected]>
To: Tom Lane <[email protected]>
Cc: jian he <[email protected]>
Cc: [email protected]
Subject: Re: Making jsonb_agg() faster
Date: Sun, 7 Dec 2025 08:13:42 +0800
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
References: <[email protected]>
	<CACJufxHuE-P0s1PxiRja26ZMjKUZiCAgWa1jedswo94SFzjXMg@mail.gmail.com>
	<[email protected]>
	<CACJufxGHLYtvOAB7uA59C9Lz+rDPta5Egiii-B5opsZbw6eDDQ@mail.gmail.com>
	<[email protected]>
	<[email protected]>
	<[email protected]>
	<[email protected]>
	<[email protected]>
	<[email protected]>
	<[email protected]>
	<[email protected]>
	<[email protected]>
	<[email protected]>
	<[email protected]>
	<[email protected]>



> On Dec 7, 2025, at 03:00, Tom Lane <[email protected]> wrote:
> 
> Chao Li <[email protected]> writes:
>> On Dec 6, 2025, at 07:14, Tom Lane <[email protected]> wrote:
>>> I'd kind of like to get this pushed soon, because it keeps getting
>>> sideswiped ... does anyone have further comments?
> 
>> My only nit commit is still about the hard-coded 12:
>> I commented this before and you explained. But I still think it may deserve a comment for why 12 is here, otherwise future reader may also get the same confusion as when I first time read this code.
> 
> I've been thinking of that as an independent issue.  But what I'm
> inclined to do is add a symbol to date.h, say like
> 
> diff --git a/src/include/utils/date.h b/src/include/utils/date.h
> index 7316ac0ff17..2aca785b65d 100644
> --- a/src/include/utils/date.h
> +++ b/src/include/utils/date.h
> @@ -30,6 +30,14 @@ typedef struct
> int32 zone; /* numeric time zone, in seconds */
> } TimeTzADT;
> 
> +/*
> + * sizeof(TimeTzADT) will be 16 on most platforms due to alignment padding.
> + * However, timetz's typlen is 12 according to pg_type.  In most places
> + * we can get away with using sizeof(TimeTzADT), but where it's important
> + * to match the declared typlen, use TIMETZ_TYPLEN.
> + */
> +#define TIMETZ_TYPLEN 12
> +
> /*
>  * Infinity and minus infinity must be the max and min values of DateADT.
>  */
> 
> and then use that.  (I poked around in other code using TimeTzADT,
> and could not find any other places where we have hard-wired "12",
> which seems a bit surprising perhaps.  But pretty much all the
> references to sizeof(TimeTzADT) are in palloc's, where it's fine.)

That’s even better than resolving my comment.

Best regards,
--
Chao Li (Evan)
HighGo Software Co., Ltd.
https://www.highgo.com/









view thread (25+ 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]
  Subject: Re: Making jsonb_agg() faster
  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