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 1n5DZE-0003dU-Hf for pgsql-hackers@arkaria.postgresql.org; Wed, 05 Jan 2022 21:11:32 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1n5DZB-0007gR-Gf for pgsql-hackers@arkaria.postgresql.org; Wed, 05 Jan 2022 21:11:29 +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 <9erthalion6@gmail.com>) id 1n5DZB-0007gI-64 for pgsql-hackers@lists.postgresql.org; Wed, 05 Jan 2022 21:11:29 +0000 Received: from mail-wm1-x334.google.com ([2a00:1450:4864:20::334]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from <9erthalion6@gmail.com>) id 1n5DZ4-0004hR-Na for pgsql-hackers@postgresql.org; Wed, 05 Jan 2022 21:11:28 +0000 Received: by mail-wm1-x334.google.com with SMTP id o30so496842wms.4 for ; Wed, 05 Jan 2022 13:11:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=0iAOyv6EwKl6mMN0wHPRmE8aftAsUzYxuCyP7Gbw+JE=; b=VoP1mGgBSrHjCDneChNY0yYc48A9VBW9qZCoy0LfgNklPP3DCY8WgrWKU70o41Bly5 NAcm6AMa8MVhaO2AE2yuvFsqLGpMdo94Q1zYH2Whk3Fpq+W+p2UaOAugNFkuVjST7ERO nOvHTC797mdPmnP+U6+eypetwi8pn90907FwpKSpSfRUv4siNZnNvQ2Qa97wpVavKd1Y w6VqDap8q8y/Z4SsPDajHQFgeVMGsYt6u2gvBWurYmlHuaQdW7kDOlZP+8plG9pAQojv gH5ffyMRY8wggIL9h5TKTUHyDElAG+Ks2SiHFHb1uCX/JC5onygpuVH4lQNJrDeRFZI4 oidA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=0iAOyv6EwKl6mMN0wHPRmE8aftAsUzYxuCyP7Gbw+JE=; b=EZuYPWB828fCj/LDr9sEHLRP089l+2Aztd4QNwrXOF5N2ZAhbvCScv4CkH8sFSYmSK R6PvMmUK3RrnyhepWVJZgPtDvJcB9VjOYRo1qrVDIpm/pHTjja7icpyWDR3M3jblM01n bo+r0NGGdSQeCS2srkksFVjl8u9suJqOd/uyYu6bt2mA+9pmWlHxUO/j1ksJTJbPT0VA yuEVIrgD1/RYB78vgvOZZT2puC+EPtF3qqgvsQMrVlJqRToDhjqwf0z4N1/UfuH2/IKB m8xqAjSuHvDSqS5NIKjJqdUH36Eub74KzaYIQ8u09Ag5g5Z8Oi2LNCH86JVflbLzaYvc fhdg== X-Gm-Message-State: AOAM532CL0Rt+iXmw+sETyQrGrwlpWCMxqdEmhAt4oGY995IesBBk4bp gyO/Iu2DPWA9/6mHxlQ8Kys= X-Google-Smtp-Source: ABdhPJz9r+kilrdjEJdDjlJRq13IA+EWqxNYbmGy/mN6rnqdBaecNlpuxpKe09tgf/VpDnkhrGdU3Q== X-Received: by 2002:a05:600c:384e:: with SMTP id s14mr4383664wmr.53.1641417080838; Wed, 05 Jan 2022 13:11:20 -0800 (PST) Received: from erthalion.local (dslb-178-012-041-031.178.012.pools.vodafone-ip.de. [178.12.41.31]) by smtp.gmail.com with ESMTPSA id m12sm99587wrp.49.2022.01.05.13.11.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Jan 2022 13:11:20 -0800 (PST) Date: Wed, 5 Jan 2022 22:11:11 +0100 From: Dmitry Dolgov <9erthalion6@gmail.com> To: Tom Lane Cc: Zhihong Yu , David Steele , PostgreSQL-development , Greg Stark , Pavel Trukhanov Subject: Re: pg_stat_statements and "IN" conditions Message-ID: <20220105211111.5oh7ypjfonaqubuq@erthalion.local> References: <20210105125230.etgmgixnn6fmpszl@localhost> <20210318155002.ggrgf2p2mvaodcox@localhost> <20210615151850.6nsue7z5xjhpytle@localhost> <20210616140212.kt3n5wi3alfz5i5d@localhost> <20210930134930.d4vzwhvxhfpk2zxt@localhost> <20210930150957.tz3h3unjyrzatw6e@localhost> <4154685.1641337363@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4154685.1641337363@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk > On Tue, Jan 04, 2022 at 06:02:43PM -0500, Tom Lane wrote: > 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. Hm, which consumers do you mean here, potential extension? Isn't the ability to use an external module to compute queryid make this situation possible anyway? > do you really think that a query with two int > parameters is equivalent to one with five float parameters for all > query-identifying purposes? Nope, and it will be hard to figure this out no matter which approach we're talking about, because it mostly depends on the context and type of queries I guess. Instead, such functionality should allow some reasonable configuration. To be clear, the use case I have in mind here is not four or five, but rather a couple of hundreds constants where chances that the whole construction was generated automatically by ORM is higher than normal. > I can see the merits of allowing different numbers of IN elements > to be considered equivalent for pg_stat_statements, but this patch > seems to go far beyond that basic idea, and I fear the side-effects > will be very bad. Not sure why it goes far beyond, but then there were two approaches under consideration, as I've stated in the first message. I already don't remember all the details, but another one was evolving around doing similar things in a more limited fashion in transformAExprIn. The problem would be then to carry the information, necessary to represent the act of "merging" some number of queryids together. Any thoughts here? The idea of keeping the original queryid untouched and add another type of id instead sounds interesting, but it will add too much overhead for a quite small use case I guess.