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 1oo5Qy-0005LS-FR for pgsql-bugs@arkaria.postgresql.org; Thu, 27 Oct 2022 16:08:44 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1oo5Qx-00065Q-81 for pgsql-bugs@arkaria.postgresql.org; Thu, 27 Oct 2022 16:08:43 +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 ) id 1oo5Qw-00065H-W3 for pgsql-bugs@lists.postgresql.org; Thu, 27 Oct 2022 16:08:42 +0000 Received: from mail-pj1-x1036.google.com ([2607:f8b0:4864:20::1036]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1oo5Qt-0003FU-T3 for pgsql-bugs@lists.postgresql.org; Thu, 27 Oct 2022 16:08:41 +0000 Received: by mail-pj1-x1036.google.com with SMTP id pb15so1988124pjb.5 for ; Thu, 27 Oct 2022 09:08:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=Qv3qN1fVpORaMnLCMkaVBiZjhJuXfqFCC75w1obhK0E=; b=aCVES+weSnYBlAVqEVmT5LaBitADxz78jf9PNN3Uw/h1QjA/76SiT+rbRS8IlLZ7WE Gh+T9tWgV7ngvDQ5F8rcmLk2KALv8zsWJqtR5aylBllCxOJnbDIg4WiTygsGe5V7etmC mkisb/wo5G7Ie72GqIfMbFm4Pqvs/YY/MsmAYcwESod0CTxpDohXxEzuinB+k97pCMN8 4GgLL7pcScAcFlCA1CIzCs87bCf8gKoUpM8VNBJQpTqUaoHzI5gzPYpqRQ3x5IIw8UmV L2BSi8jFq+bXMgF+ggbYkTLjR2JngpxdfkeMqt6e4zo18QepJWXJc/wCzO6Io1ri6c/l OraA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=Qv3qN1fVpORaMnLCMkaVBiZjhJuXfqFCC75w1obhK0E=; b=ZnMTcmeow3q1hopkC+OUnG9+YzbmcEYoq8Yl5nbQMsZttDcMH51NrWNzAFfqfx3rDv 7bRDqgh4ACVYvPjGgwbewOhgzLCGtAzAJnNvFOQZS2FMpgpVzUiNSFHX15+7Tm6KZmD2 dYUN95OnqY1Q7xR9TRslDSLwafypnkyZ9cRBy8Ztu+JE14htvKS51QgrZ0We6wYhF7vG oSO7YthTPDNbgEer4irTXzqzwQbKF6iG3gBwTukrS4xQZu7eLDAgHsk1lA7VPetD9+zV zkhmZ7AANCMhCEGp5Ce1u+sJv9hUq4xIuePIcIxj7cQnt6ZfHwZ0Du4bzlXzgHGlqVlv osnQ== X-Gm-Message-State: ACrzQf2eziavj1cC4iwFKAoqvdnAKH5iLZ7G4EWKvCHMgrK32iclX/L4 BLhUd43tq6mgw4uMbiQ/vco= X-Google-Smtp-Source: AMsMyM6iyjlDjpcNtlER0NDxE5ew3LEvCCzhdUlaI+riQEUxoMz/pN5gRJlh2gg8zNDY7hF5IW05Ew== X-Received: by 2002:a17:90b:1b0b:b0:20d:7c31:e75d with SMTP id nu11-20020a17090b1b0b00b0020d7c31e75dmr10629275pjb.101.1666886918869; Thu, 27 Oct 2022 09:08:38 -0700 (PDT) Received: from jrouhaud (2001-b011-1006-d206-f9e2-1848-0e75-7d0e.dynamic-ip6.hinet.net. [2001:b011:1006:d206:f9e2:1848:e75:7d0e]) by smtp.gmail.com with ESMTPSA id p6-20020a17090a930600b0020d39ffe987sm1155549pjo.50.2022.10.27.09.08.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Oct 2022 09:08:38 -0700 (PDT) Date: Fri, 28 Oct 2022 00:08:34 +0800 From: Julien Rouhaud To: marcus.kempe@gmail.com, pgsql-bugs@lists.postgresql.org Subject: Re: BUG #17668: Query normalization generates multiple queryId:s for calls to the same procedure Message-ID: <20221027160834.uxhmt473grlpfv5x@jrouhaud> References: <17668-e25abc1f5375b095@postgresql.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <17668-e25abc1f5375b095@postgresql.org> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi, On Thu, Oct 27, 2022 at 01:49:18PM +0000, PG Bug reporting form wrote: > > postgres=# select calls,userid,dbid,queryid,query from > public.pg_stat_statements where query like 'select test%'; > calls | userid | dbid | queryid | query > -------+--------+-------+----------------------+----------------- > 1 | 10 | 13757 | -8729651821477628722 | select test($1) > 1 | 10 | 13757 | 1452143938866253601 | select test($1) > (2 rows) > > So given the above 2 calls for the same function, there are 2 different > queryIds generated, seemingly based on the fact that in the first case the > parameter can be cast to integer, and in the second case it can not. > > I would have expected both calls to be normalized and fingerprinted to one > and the same queryId. Agreed, and that's actually a known problem that is currently being worked on. You can look at https://www.postgresql.org/message-id/flat/36e5bffe-e989-194f-85c8-06e7bc88e6f7%40amazon.com for details about the discussion and in-progress fix.