Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1n4y3i-0003jb-Ut for pgsql-hackers@arkaria.postgresql.org; Wed, 05 Jan 2022 04:38:00 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1n4y3h-00028n-JT for pgsql-hackers@arkaria.postgresql.org; Wed, 05 Jan 2022 04:37:57 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1n4y3h-00028e-7F for pgsql-hackers@lists.postgresql.org; Wed, 05 Jan 2022 04:37:57 +0000 Received: from mail.postgrespro.ru ([93.174.131.139]) by magus.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1n4y3a-0004kQ-Ue for pgsql-hackers@postgresql.org; Wed, 05 Jan 2022 04:37:56 +0000 Received: from [192.168.129.212] (unknown [91.205.25.74]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mail.postgrespro.ru (Postfix) with ESMTPSA id 2D24921C34F6; Wed, 5 Jan 2022 07:37:49 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=postgrespro.ru; s=mail; t=1641357469; bh=VMwVyMpxNC46fKvd6/Dsjca7rvzTyEm4sgc6HnRs/6U=; h=Subject:To:Cc:References:From:Date:In-Reply-To; b=apcjVg/56UQu1bIhGLXSLaj2kZb0PshO5k/EMb3oDZPFJx5W2BTVONWsf+z/98C75 v2pu63M3Zxs1fWE/gNAV7ZC74LpjnE4Qg6+oJoxE+NUihPljQqA4A9H4BsytEuDDIs sX1BN7WmIJEBmRSKu1gc7jJAfYu3e2kKx4tBomE0= Subject: Re: pg_stat_statements and "IN" conditions To: Tom Lane , Dmitry Dolgov <9erthalion6@gmail.com> Cc: Zhihong Yu , David Steele , PostgreSQL-development , Greg Stark , Pavel Trukhanov References: <20201226104635.uvzkftzu72zg5qux@localhost> <20210105125230.etgmgixnn6fmpszl@localhost> <20210318155002.ggrgf2p2mvaodcox@localhost> <20210615151850.6nsue7z5xjhpytle@localhost> <20210616140212.kt3n5wi3alfz5i5d@localhost> <20210930134930.d4vzwhvxhfpk2zxt@localhost> <20210930150957.tz3h3unjyrzatw6e@localhost> <4154685.1641337363@sss.pgh.pa.us> From: "Andrey V. Lepikhov" Organization: Postgres Professional Message-ID: Date: Wed, 5 Jan 2022 09:37:33 +0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.14.0 MIME-Version: 1.0 In-Reply-To: <4154685.1641337363@sss.pgh.pa.us> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 1/5/22 4:02 AM, Tom Lane wrote: > Dmitry Dolgov <9erthalion6@gmail.com> writes: >> And now for something completely different, here is a new patch version. >> It contains a small fix for one problem we've found during testing (one >> path code was incorrectly assuming find_const_walker results). > > I've been saying from day one that pushing the query-hashing code into the > core was a bad idea, and I think this patch perfectly illustrates why. > We can debate whether the rules proposed here are good for > pg_stat_statements or not, but it seems inevitable that they will be a > disaster for some other consumers of the query hash. In particular, > dropping external parameters from the hash seems certain to break > something for somebody +1. In a couple of extensions I use different logic of query jumbling - hash value is more stable in some cases than in default implementation. For example, it should be stable to permutations in 'FROM' section of a query. And If anyone subtly changes jumbling logic when the extension is active, the instance could get huge performance issues. Let me suggest, that the core should allow an extension at least to detect such interference between extensions. Maybe hook could be replaced with callback to allow extension see an queryid with underlying generation logic what it expects. -- regards, Andrey Lepikhov Postgres Professional