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 1ltApK-0004K2-KZ for pgsql-hackers@arkaria.postgresql.org; Tue, 15 Jun 2021 15:18:07 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1ltApH-0004iK-Uf for pgsql-hackers@arkaria.postgresql.org; Tue, 15 Jun 2021 15:18:03 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from <9erthalion6@gmail.com>) id 1ltApH-0004iC-5p for pgsql-hackers@lists.postgresql.org; Tue, 15 Jun 2021 15:18:03 +0000 Received: from mail-ed1-x52f.google.com ([2a00:1450:4864:20::52f]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from <9erthalion6@gmail.com>) id 1ltApD-0004b2-A6 for pgsql-hackers@postgresql.org; Tue, 15 Jun 2021 15:18:02 +0000 Received: by mail-ed1-x52f.google.com with SMTP id b11so51650556edy.4 for ; Tue, 15 Jun 2021 08:17:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to; bh=BRsqDOxUlMpl4VqpArXKEo4vWZI8KnfrCUgtBy5lxtg=; b=pc0SDIQIrp8svrFnM/wbNg5QKIneGYA4IMf5QY/Oles1g+AW1pPfBghyp3qPnI7Weh FD7Ff2KMV5RYd65mTLAGiej6hNTkyfBD6jenx3yhdbrEl1He6+wq0prtoJ9AGiZW7JGr WyNnbhIT1LV5S6sBQEmciercgwAwtvKF1kywRkfCuPJUBrV80dP2eSP+GtetpiT75x0w cios5UgN4SA4TRUcCdrxmTw+7G/wvdhblKtWbd/u7GZBFhJtRQCZO+OAGKoDwtRZIJ1f FDI0uDsDnoG4pt3lwp5B8bmfcakfUZgVMHhnZcCVS8voYsqazJ9x1l0f5xlPicIJITId OgQg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=BRsqDOxUlMpl4VqpArXKEo4vWZI8KnfrCUgtBy5lxtg=; b=sZeOLseE8y6pXarh11hg1v1SqqfCr2qfXR9aGREOyQx9p/GHm+eXCboAfLW3+osN6w sB06RSFcrY+QbJ0N389FzLE8SEKRSZIDnyfyXqq16LtRD8pPH7QH1zgUTYuWFP/Fvaqd PVixIe5FYbL7KiBpnUN0VHvYoiPuG05vEQPTpgoKslMMAEvC6HMpxW6aoFxQAKuYfKf+ zBKQqWLrvHSQYi5lrhkvudER8PyjMZD/L0iCISk8bSINENSbQELJkR9iowN+frC/JgHx OC2VJYHPE+Fe4/XkL1UFoIksfR1v0hscueg06wXiuLEW3ljFhyc+JlIQWsLNhlhuIX9D pKwA== X-Gm-Message-State: AOAM533RPAFfIEtbogm54I8YC9XS7JVRRrZMZQlwnfKDduGvjD9DqRr7 AsV2qXD1Z+buBB+Pc2KODDc= X-Google-Smtp-Source: ABdhPJxtnF4vvKnBST/JN0XgIJZ076AUQqGSXns9kKdTTsk149oRN9WcryVeJ/kS2whwJs6PxboBcA== X-Received: by 2002:a05:6402:31f3:: with SMTP id dy19mr23844584edb.153.1623770274852; Tue, 15 Jun 2021 08:17:54 -0700 (PDT) Received: from localhost (dslb-178-012-117-163.178.012.pools.vodafone-ip.de. [178.12.117.163]) by smtp.gmail.com with ESMTPSA id f6sm9977493eja.108.2021.06.15.08.17.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 15 Jun 2021 08:17:53 -0700 (PDT) Date: Tue, 15 Jun 2021 17:18:50 +0200 From: Dmitry Dolgov <9erthalion6@gmail.com> To: David Steele Cc: Zhihong Yu , PostgreSQL-development , Tom Lane , Greg Stark , Pavel Trukhanov Subject: Re: pg_stat_statements and "IN" conditions Message-ID: <20210615151850.6nsue7z5xjhpytle@localhost> References: <20201118160432.hyko73sqc2bf7nkj@localhost> <20201226104635.uvzkftzu72zg5qux@localhost> <20210105125230.etgmgixnn6fmpszl@localhost> <20210318155002.ggrgf2p2mvaodcox@localhost> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="tedwtzge5may6y5n" Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20210318155002.ggrgf2p2mvaodcox@localhost> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --tedwtzge5may6y5n Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit > On Thu, Mar 18, 2021 at 04:50:02PM +0100, Dmitry Dolgov wrote: > > On Thu, Mar 18, 2021 at 09:38:09AM -0400, David Steele wrote: > > On 1/5/21 10:51 AM, Zhihong Yu wrote: > > > > > > +   int         lastExprLenght = 0; > > > > > > Did you mean to name the variable lastExprLenghth ? > > > > > > w.r.t. extracting to helper method, the second and third > > > if (currentExprIdx == pgss_merge_threshold - 1) blocks are similar. > > > It is up to you whether to create the helper method. > > > I am fine with the current formation. > > > > Dmitry, thoughts on this review? > > Oh, right. lastExprLenghth is obviously a typo, and as we agreed that > the helper is not strictly necessary I wanted to wait a bit hoping for > more feedback and eventually to post an accumulated patch. Doesn't make > sense to post another version only to fix one typo :) Hi, I've prepared a new rebased version to deal with the new way of computing query id, but as always there is one tricky part. From what I understand, now an external module can provide custom implementation for query id computation algorithm. It seems natural to think this machinery could be used instead of patch in the thread, i.e. one could create a custom logic that will enable constants collapsing as needed, so that same queries with different number of constants in an array will be hashed into the same record. But there is a limitation in how such queries will be normalized afterwards — to reduce level of surprise it's necessary to display the fact that a certain query in fact had more constants that are showed in pgss record. Ideally LocationLen needs to carry some bits of information on what exactly could be skipped, and generate_normalized_query needs to understand that, both are not reachable for an external module with custom query id logic (without replicating significant part of the existing code). Hence, a new version of the patch. --tedwtzge5may6y5n Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v4-0001-Prevent-jumbling-of-every-element-in-ArrayExpr.patch"