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.94.2) (envelope-from ) id 1tnF0c-003TKX-6Z for pgsql-hackers@arkaria.postgresql.org; Wed, 26 Feb 2025 10:51:22 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1tnF0Z-003Dd5-NO for pgsql-hackers@arkaria.postgresql.org; Wed, 26 Feb 2025 10:51:19 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tnF0Z-003Dcw-Cu for pgsql-hackers@lists.postgresql.org; Wed, 26 Feb 2025 10:51:19 +0000 Received: from forward102b.mail.yandex.net ([178.154.239.149]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1tnF0W-000BRR-0r for pgsql-hackers@postgresql.org; Wed, 26 Feb 2025 10:51:19 +0000 Received: from mail-nwsmtp-smtp-production-main-55.sas.yp-c.yandex.net (mail-nwsmtp-smtp-production-main-55.sas.yp-c.yandex.net [IPv6:2a02:6b8:c11:418a:0:640:cf79:0]) by forward102b.mail.yandex.net (Yandex) with ESMTPS id 69478609FA; Wed, 26 Feb 2025 13:51:15 +0300 (MSK) Received: by mail-nwsmtp-smtp-production-main-55.sas.yp-c.yandex.net (smtp/Yandex) with ESMTPSA id Dpa29S2LlOs0-uD71B0kN; Wed, 26 Feb 2025 13:51:14 +0300 X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tantorlabs.com; s=mail; t=1740567074; bh=D04udMmA5XrwHA5m6g1q/m/OtEXJPCjfxvskJONnfow=; h=From:In-Reply-To:Cc:Date:References:To:Subject:Message-ID; b=O35sgly9W70xWUTIk4gZOXkBuQbLuiEC3Hea0HGVXBzX/DrvutFTCJ2Sl/N23dG7V 2mBz34AMK9AAq0br0058WpJYb4pXtfCDrqcyImo+Xem/9Nsh9j9AwM71DL/uYZ4a6Z fwItZrtEAyOe8uj0sExqPA7r7z41KXLClJ4mUiGs= Authentication-Results: mail-nwsmtp-smtp-production-main-55.sas.yp-c.yandex.net; dkim=pass header.i=@tantorlabs.com Message-ID: <4124423f-b9bb-40e8-ab4d-a08010ab83ab@tantorlabs.com> Date: Wed, 26 Feb 2025 13:51:13 +0300 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Sample rate added to pg_stat_statements To: Sami Imseih Cc: Alexander Korotkov , Michael Paquier , Greg Sabino Mullane , Andrey Borodin , Alena Rybakina , pgsql-hackers References: <0c7770bd-9750-4200-a472-bdb262583c2f@tantorlabs.com> <18631d46-1741-4edc-b116-8d9631cdf919@tantorlabs.com> <4f98ec33-c627-4eb4-84f3-9994a0982277@tantorlabs.com> <623db69f-b40a-4d50-b1bd-bb073fcc4336@tantorlabs.com> <3546e2a7-5831-4c0a-996b-358d4ec483a6@tantorlabs.com> <6bf3059f-7ebe-4640-8870-1220f83b88ed@tantorlabs.com> <7b9df88f-3015-464b-881e-4c6a7b3a5c03@tantorlabs.com> <6f305fd1-44c3-4189-81ef-238777277e5e@tantorlabs.com> Content-Language: en-US From: Ilia Evdokimov In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 20.02.2025 03:32, Sami Imseih wrote: >> As you can see, the query has not been normalized. Is it a bug, expected or undefined behavior? > No, this behavior is expected. The ability to normalize a statement is > only available > during post_parse_analyze (pgss_post_parse_analyze), as this is when > we have access to > JumbleState. > > In your example, pgss_post_parse_analyze is skipped and during the > subsequent \bind_named, > ExecutorEnd (pgss_ExecutorEnd) does not have access to JumbleState, > leading to the query to be stored without normalization. > > It will be nice to make JumbleState available to all hooks, IMO. > > -- > Sami Got it. I think it's worth considering, but not within the scope of this thread. -- Best regards, Ilia Evdokimov, Tantor Labs LLC.