Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vS2Q0-00FkeV-1p for pgsql-hackers@arkaria.postgresql.org; Sun, 07 Dec 2025 00:14:28 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vS2Px-00CgYK-27 for pgsql-hackers@arkaria.postgresql.org; Sun, 07 Dec 2025 00:14:25 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vS2Px-00CgYC-0u for pgsql-hackers@lists.postgresql.org; Sun, 07 Dec 2025 00:14:25 +0000 Received: from mail-pl1-x62d.google.com ([2607:f8b0:4864:20::62d]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1vS2Pu-003W6I-2B for pgsql-hackers@lists.postgresql.org; Sun, 07 Dec 2025 00:14:24 +0000 Received: by mail-pl1-x62d.google.com with SMTP id d9443c01a7336-297e264528aso32391985ad.2 for ; Sat, 06 Dec 2025 16:14:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1765066462; x=1765671262; darn=lists.postgresql.org; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=upSRqQh5v8o2c6TxN/s6zxL0sXQ4/rwp985XYzVHpJk=; b=MCxWfnknA1Q04B2Gecj5hK9Fl+uF7mn9QK+VOm6fhqKUmBmhXjlxhR/2EK4kD2jXT1 CEnpGQkb4uFSaUf1BioR3bUsOizcxKnY9jJwuhw9YWVaVKgbyX8TmEbXF/dPEKYyJVt+ DAr0hEcu9dtg0qPHIjxDgw1J+4G7o0E6iqpue2c7OnQwf9axJzaVB4xjU3KqdsFXMqvQ F1SxECTMawKjhFjo39fLFaKRak5ftdwLgQ1JIFI3yI94NUasDDGFduKL6WqRUvkTSkfy SNVVWMR0HuI0O5fkSbCNp2tz7MA+C0a5NZvQLIkOq/Odx6MATYMbjzZHn+IGsmUmN/rr G43A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1765066462; x=1765671262; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:x-gm-gg:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=upSRqQh5v8o2c6TxN/s6zxL0sXQ4/rwp985XYzVHpJk=; b=gyLk9KLHyWE+jyOwXHRuEQXVJ8QUFSSU3USCTlZYA7eH+Dbf/gS68afok04Khb8c1E VPgVksi729loHvs4hh1vk1yk6TZBLhUIlgXK8rUJC7MWj6XwS+lXp6xn+DnAVTaTMtXt CsLYhs2xy/41QsltJKbmNqQD71+PenZg5pNYOQmaUiRLTN544NGZ2cCOn3DgSnt77+YI MZWNxBAN6SEu7VnPANJpeqcdaZCp1TRwCIpQ6IOnrUbo5X07ZS5r/T14a2f59W2V1B7I Uttxkv949+r+6Vmr/hqBtBgog2GwcnJdJaCkfcA4QrZ8L4924180r7oSRmbzWZKfXPDh BZ6w== X-Forwarded-Encrypted: i=1; AJvYcCWGhnAGWKjrnXoAFb+rK96WeFUOTafDvuQpHCj9jPzeudlVlCgnON8vh4lBFQoOlmlrogafTgJIYO0kwdFn@lists.postgresql.org X-Gm-Message-State: AOJu0YwtCFldQYSAZGOn3hs/F2qRqGe728JrnnihHqwy6U34q+WAaWCZ K/oLv1E3aol2vPfZAqLaZLvEigmpc54csHm8YQ4PwctDaSR0X+Q7pWiL X-Gm-Gg: ASbGncvveWDsbMDtB3lSzKbZFtGi0gNz6b5e3l4QsJ9NuGTpwvsys1Dhil+zEtWVZQ6 aCoIR4BaTD1DxCLxpe1yjmoLSJ0SeLJNU0FxshVlFPS0LvE0BWJMUG0RjmuvtfAPlpDL80cbYzH SrtQStrFW4qm4vhDLyIqmOH3HUOFtXpyMQ+CtV8pj2Jh43DF9Fg2RlAzXGflS59iI4ZB7eEASAY WeI3YON8EsgERheB4ziT26Tp/vurot8+cs/t6MjMVadAnTRjtnMDD7bnxPShzbpkW7K/l6fqVU+ 5zqxLlMhDMlF12g7FkFdtEO+wJzyEHYeehyHXNZ4pYrElYD/KwFZYfY4NIpnG26Mt6/R4kEQydz l+KHFLZJwUrQBO0y7YGIuYA+3ZwAJWcOTaHYtx4yfGzzpXdu6JfrIZcPk/6wedWBKpUhM8rUDn8 G/APWNxjJRjV1KfxhdRCw= X-Google-Smtp-Source: AGHT+IHn3nVGd4LnddXF6dd9JH8YRIivS66e19PvvsXmiriWz6jTnoohUW1XlKpzHuzYQaiJHT/DkQ== X-Received: by 2002:a17:903:1786:b0:298:4ee3:c21a with SMTP id d9443c01a7336-29df579e9f2mr31892065ad.2.1765066461656; Sat, 06 Dec 2025 16:14:21 -0800 (PST) Received: from smtpclient.apple ([45.32.121.103]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-29dae49c379sm83901425ad.6.2025.12.06.16.14.19 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 06 Dec 2025 16:14:20 -0800 (PST) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3826.700.81\)) Subject: Re: Making jsonb_agg() faster From: Chao Li In-Reply-To: <2329959.1765047648@sss.pgh.pa.us> Date: Sun, 7 Dec 2025 08:13:42 +0800 Cc: jian he , pgsql-hackers@lists.postgresql.org Content-Transfer-Encoding: quoted-printable Message-Id: <0C8ACF97-C1F0-43EA-B8FD-CD7E7ECB8190@gmail.com> References: <1060917.1753202222@sss.pgh.pa.us> <617666.1755277022@sss.pgh.pa.us> <654628.1755297629@sss.pgh.pa.us> <2129790.1755889894@sss.pgh.pa.us> <68A1061C-81A5-46AA-AFA9-48294908254C@gmail.com> <2613D418-67E0-4DD8-BDA6-AB1BB04DB1A2@gmail.com> <2466173.1756498180@sss.pgh.pa.us> <163563.1762117009@sss.pgh.pa.us> <354608.1762195230@sss.pgh.pa.us> <2052300.1763664997@sss.pgh.pa.us> <1985954.1764976473@sss.pgh.pa.us> <2329959.1765047648@sss.pgh.pa.us> To: Tom Lane X-Mailer: Apple Mail (2.3826.700.81) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk > On Dec 7, 2025, at 03:00, Tom Lane wrote: >=20 > Chao Li writes: >> On Dec 6, 2025, at 07:14, Tom Lane wrote: >>> I'd kind of like to get this pushed soon, because it keeps getting >>> sideswiped ... does anyone have further comments? >=20 >> 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. >=20 > 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 >=20 > 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; >=20 > +/* > + * 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. > */ >=20 > 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=E2=80=99s even better than resolving my comment. Best regards, -- Chao Li (Evan) HighGo Software Co., Ltd. https://www.highgo.com/