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 1m3Bce-0007Ky-C1 for pgsql-hackers@arkaria.postgresql.org; Tue, 13 Jul 2021 06:10:24 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1m3Bcc-00015m-T3 for pgsql-hackers@arkaria.postgresql.org; Tue, 13 Jul 2021 06:10:22 +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 1m3Bcc-00015e-Ja for pgsql-hackers@lists.postgresql.org; Tue, 13 Jul 2021 06:10:22 +0000 Received: from mail-pf1-x42f.google.com ([2607:f8b0:4864:20::42f]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1m3Bca-0002RH-9H for pgsql-hackers@lists.postgresql.org; Tue, 13 Jul 2021 06:10:22 +0000 Received: by mail-pf1-x42f.google.com with SMTP id d12so18619020pfj.2 for ; Mon, 12 Jul 2021 23:10:19 -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:in-reply-to; bh=AjBl9bp2EQ8EBdkVSw+EM9EOrbE07gwbO0VZVdnPxQY=; b=DbQTTvNTHUWo9Nta/AuwrnPL3cxnG8OO9lkmip/UzbL0jHdpceT0P/fehx6YH9WpSC 9ns2c9exDJWDUFS65ASJn6qPgxsL223riqCZBDZhxbhHLI/m0XgB1n+pS0/dgHM1er6I yTaexPJfnk+fDVoefGulB9Ff8SjOsKGkUM6littpn858YiMRT37OyzSQ6LA6xHjemwhc qUuRLL8LyQCxkPqTlSEEvnO9qy6Qvox6y6rKfMqdHTnkXS1JDe67HSrxp7/e+Y7mCpl2 0P0EDyUaUHANxcVYZzWuN9T/HOFTrKWpORa+DizGFNoE8HGaguZLGVSwlZZACZiI2a+d Rhmw== 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:in-reply-to; bh=AjBl9bp2EQ8EBdkVSw+EM9EOrbE07gwbO0VZVdnPxQY=; b=AuOuYvU+SysIPmfL7ZKNDDboV6mVRrl0JXiTvKlHfj5YfnicxqqahYuQtaqbFcVrW/ X8HWao40r4a/qFpbyh+rDD7JISd/fDlvyfG9jQtDx9+FID2ztWcmTwXD1+HY31vBC1Rc ZRTCU2pY5xPMUDdMfO16UwMDeeOqVLt2MLgYepKmO/OYE98tmKyHjr4pbl2uMuDy8WZS SkYN4JlX1598XHDNCVVYVDe99MOQn7H/RCzBxTVyf5tpJSaMd7bDspLrT+DYwtDJE0XE NvRHOMCghHN70TLLubrHKUd2rHJXv+T2JbP8TL0uDW0XDNiY+ddigBlkXtoEPlz0AZWv 4uyA== X-Gm-Message-State: AOAM532GjGeNX2bIpk/X8XPg7zvDc8ComWceYCdpmS6u8oCmrx0TzyH0 sZH1Fn5vyNzD/t3fUdB43YA= X-Google-Smtp-Source: ABdhPJwuBkpu5A3RgKDq2oRym820ztGkBpsyNaE9KQt+sXtVpvN57TDHvdBlI5tj8Lrkh/kZ4pHJSQ== X-Received: by 2002:a05:6a00:a8a:b029:30c:a10b:3e3f with SMTP id b10-20020a056a000a8ab029030ca10b3e3fmr2875994pfl.40.1626156617768; Mon, 12 Jul 2021 23:10:17 -0700 (PDT) Received: from nol (2001-b011-0001-54bc-75ad-beaa-8b61-9232.dynamic-ip6.hinet.net. [2001:b011:1:54bc:75ad:beaa:8b61:9232]) by smtp.gmail.com with ESMTPSA id a22sm19715968pgv.84.2021.07.12.23.10.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Jul 2021 23:10:16 -0700 (PDT) Date: Tue, 13 Jul 2021 14:10:23 +0800 From: Julien Rouhaud To: Peter Eisentraut Cc: Fujii Masao , Bruce Momjian , Alvaro Herrera , Tom Lane , Nitin Jadhav , Hannu Krosing , Robert Haas , Pavel Stehule , Michael Paquier , torikoshia , Atsushi Torikoshi , Tatsuro Yamada , Tomas Vondra , Evgeny Efimkin , PostgreSQL Hackers , Magnus Hagander Subject: Re: Feature improvement: can we add queryId for pg_catalog.pg_stat_activity view? Message-ID: <20210713061023.edgei4ooxexxsi5r@nol> References: <20210413021246.GD4231@momjian.us> <20210413173016.GA29955@alvherre.pgsql> <20210414183326.GA10946@momjian.us> <20210420162244.GD30205@momjian.us> <20210422092317.xnuvva2322dflxdm@nol> <8f5e63b8-e8ed-0f80-d8c4-68222624c200@enterprisedb.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <8f5e63b8-e8ed-0f80-d8c4-68222624c200@enterprisedb.com> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Mon, Jul 12, 2021 at 10:02:59PM +0200, Peter Eisentraut wrote: > On 22.04.21 11:23, Julien Rouhaud wrote: > > The statistics gathered by the module are made available via a > > view named pg_stat_statements. This view > > - contains one row for each distinct database ID, user ID and query > > - ID (up to the maximum number of distinct statements that the module > > + contains one row for each distinct database ID, user ID, query ID and > > + toplevel (up to the maximum number of distinct statements that the module > > can track). The columns of the view are shown in > > . > > I'm having trouble parsing this new sentence. It now says essentially > > "This view contains one row for each distinct database ID, each distinct > user ID, each distinct query ID, and each distinct toplevel." Isn't it each distinct permutation of all those fields? > That last part doesn't make sense. I'm not sure what you mean by that. Maybe it's not really self explanatory without referring to what toplevel is, which is a bool flag stating whether the statement was exected as a top level statement or not. So every distinct permutation of (dbid, userid, queryid) can indeed be stored twice, if pg_stat_statements.track is set to all. However in practice most statements are not executed both as top level and nested statements.