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 1w7IAa-0059Zc-03 for pgsql-hackers@arkaria.postgresql.org; Mon, 30 Mar 2026 19:21:04 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1w7IAY-005uka-0x for pgsql-hackers@arkaria.postgresql.org; Mon, 30 Mar 2026 19:21:02 +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 1w7IAY-005ukS-02 for pgsql-hackers@lists.postgresql.org; Mon, 30 Mar 2026 19:21:02 +0000 Received: from mail-ej1-x62e.google.com ([2a00:1450:4864:20::62e]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1w7IAW-00000001r1p-2b5j for pgsql-hackers@postgresql.org; Mon, 30 Mar 2026 19:21:01 +0000 Received: by mail-ej1-x62e.google.com with SMTP id a640c23a62f3a-b9841aecf72so584925366b.2 for ; Mon, 30 Mar 2026 12:21:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1774898459; cv=none; d=google.com; s=arc-20240605; b=YjeVx73pHDjeuDURY0bvpLgeh3AsLYNRa3T7J22/uDKvcXFhMDlPFRwrNFxAelmp1T tUwR81OgMPsObvj27bqbtBw8sw0GA/5Gy8ZAKe5FZeJMe5YfIcxaiyqY6MY3LbW2qzzG 5GLiv4BDU4VjBUtnNDWjRNm76bncQGaTTSMbJPraday/zXffUqVogRKdElPMq7qgwkoq BWBw+rhBg+bu6cCQucCIe+A/Q33RiDau+9TcGjc/38sHEouXbK7ShgxDfKQo4z1quCAz VK+OwMwPtqYPelcp1AobHHPUeiCODjVd6QjIFd1P0fhhcQX8ptcS2CpakqFskxLXUSb8 NiuA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=EON7nbIBDTWB707Rt6J284ODfblY1SO5byPgdpYdf3A=; fh=osFHjF7EpMQjIGtsvetkHPeZNQaPCLmGvIgNFOhoqhw=; b=aWs80YhDSvdBivlUvXUx6Tl+5qgoqfx4ZQX7pxNtVwCnLUhUc6+EWSQKf156vn+792 s7KubsHhqxZhbMjRnpF7VDu1qqut0LvBo0ocTVzZNiB40Ys//fp6HtumtWEJr8Mndwp2 OSloGlAM/rLV+U8uvyUHsS4xLVU/kvw65yjojGTqIDFPCs8MhOT7Yuet3KMwfNR7LZFt bM/bAP+jaBeWxYvvixB0A3SxxPtUqjpQ1j+NCeqlNMKQnB+hLg8OTV3kkZZ0J36xyoUh noD9Dj6jDNkAdh7M2ZgQbrxwwlfNm1iyS3s7odfNiif31+1XJHnLaES1WcMQbHcKspu7 2gxQ==; darn=postgresql.org ARC-Authentication-Results: i=1; mx.google.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1774898459; x=1775503259; darn=postgresql.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=EON7nbIBDTWB707Rt6J284ODfblY1SO5byPgdpYdf3A=; b=nTW6StAeymJPDjvTzQQ8KvaiwoXZHE51p/6NJTMupTDH2lUz1yfJwPOQyduOrTbef7 5TNv1whdCnW3pPWmmpJEoHKBH4NMm0THWhZjskQGd8fPjrFORORL6MBnJ48UkFxj9orv irsy8RADh6+WqvaYTyEPtE7skbb6cchGIdpM0zrATy1lUhwBMDvJ5aU7n7UVtJSunTB+ ZSjahqN6GnWMPImwCVZiS8TvOLTOHSQH2AmdoTDa8J/ljaUWigHUDAFDylaTqdmHfwqV HQxnuw41MqsNq6HoEEY8NjUtT6hDeDjTVE8p9DqHmUvdgY/JHZBVhZHLpzy7wZxKf6TB +lbQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1774898459; x=1775503259; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=EON7nbIBDTWB707Rt6J284ODfblY1SO5byPgdpYdf3A=; b=ETfENpH7l7amBO4xphZEJBbQO3enIRWcNPrzMFWe7KeQrFViQhGDKoJ+NNh4YOpg2q 1PGnXVLdjwAJO1+tj5AdpnOqlqKfSfTBh4kR9u7H3Lpvl6bingYldtIaabnvrQWdJUU4 XvE/xhAzeC1hMty1OvQaVxSed8MRwjogfU6qvSWyS+cZBTlLKTalPmLjCm4dE/wXjHDk T42n+ghZ66Nn2OwhmCv1xK8y7dd4W0ml+4ot/Y6Hx60AReSNUjA3CGWUirc6picEZQGh 8C91q3JMi/+gWXGpI7xkPQQPgE46OXE/O58kXJATAysaljcDVYWgDqWxpn69uLvA71VZ /4Wg== X-Forwarded-Encrypted: i=1; AJvYcCUKtwhR498kuNfVux7A0dp8X06dXk9PzoQ9OcSbEAmN1/ayAMyHY4Q/Y1C5pLVsWy3Y/4DP2uSXvTHgTUbN@postgresql.org X-Gm-Message-State: AOJu0YyWnZanvv74K/f5q5iTty7dmeQFEq8YN2s8R8AWTM1m5PlNTORE hySex3IR5gF80Zk6nK+SV7qhuttNWVXDzX9vZEe+UdJsYu+puMaNmhxoBB1U2gcl1TEyAajQA5t 9cAz93n3tMF3iTCPxun3Q21GoXdCdM10= X-Gm-Gg: ATEYQzyVEEsG0OA2jal5E+x9wgYlUf6ZhD5Xe5oLkBPyp2LymSsaGI0KhbGqd97N5+S 3uS/muLyKmee1T8j51RmPx3ufE89lvdIdqY7lHzpiDwHj88HR1ZHS6m2FFc8/162KmGWumBeX92 01pb4GaGHj7R7rb/ydmPMzrIhB8WzXxYUn29T+s2MTq46C4bYu/KGXevRTMGKy62IceqTkujLjJ lcBjHXhtPDE6u2un/geJYYU12hROAlMT8jnCeInYKFZc6uciQnSkqm8MDXO4oWEOTeqc3zuHQcF OOVlFw== X-Received: by 2002:a17:906:b39e:b0:b98:d53:4f50 with SMTP id a640c23a62f3a-b9b5094518bmr611744666b.46.1774898458747; Mon, 30 Mar 2026 12:20:58 -0700 (PDT) MIME-Version: 1.0 References: <8437F4D0-9DFB-4045-9318-CC3C5BA2E267@paquier.xyz> In-Reply-To: From: Sami Imseih Date: Mon, 30 Mar 2026 14:20:47 -0500 X-Gm-Features: AQROBzCIgJMcljdwhpfXodvAVUteB5LwMmgixCEvihrqxqTESjS5DPzyLpba5nA Message-ID: Subject: Re: Refactor query normalization into core query jumbling To: Lukas Fittl Cc: Michael Paquier , zengman , pgsql-hackers , Julien Rouhaud Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk > > > I agree that ComputeConstantLengths should be in core. This one is > > > not a gray area IMO. The query jumble already records constant locati= ons, > > > but leaves the lengths unset. ComputeConstantLengths is just the > > > completion of that work. There could be no other interpretation, > > > unlike generate_normalized_query, of what the lengths should be. > > > > This is an interesting remark. One problem with any patches presented y= et is that we don=E2=80=99t attach the lengths as part of the in-core query= jumbling procedure: we plug the lengths later using the same structure as = the query jumbling. It seems to me that this is half-baked overall. I think= that we don=E2=80=99t want to pay the extra length computation in the core= query jumbling at the end, then why does it make sense to include the leng= ths in the JumbleState structure at all? Shouldn=E2=80=99t we use a differe= nt structure filled inside PGSS for this purpose rather than reuse the same= thing for PGSS and the in-core part (don=E2=80=99t have the code in front = of me now). > > I see where you're coming from on that, but I don't think we can > remove anything here in practice: Yes. Not unless we want to rely on the parser to track the lengths in Const, which could be invasive, but I have not looked into it. Paying the length computation at the end of every jumble is also going to impact performance, so that will not be a good idea. > I still think it'd be reasonable for us to include > ComputeConstantLengths in core to complete the picture of what we're > doing with _jumbleElements and the length field already anyway. Its > basically a way to fully hydrate the partially filled out JumbleState > from the initial jumble. I fully agree, ComputeConstantLengths is an optional post-jumble-query step for a consumer that wishes to calculate the lengths. The length calculation is not unique to a plug-in, so in my mind the work it's doing is core jumbling functionality. -- Sami Imseih Amazon Web Services (AWS)