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 1kPYGC-0004cl-MP for pgsql-hackers@arkaria.postgresql.org; Mon, 05 Oct 2020 21:43:08 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kPYGA-0000iA-7b for pgsql-hackers@arkaria.postgresql.org; Mon, 05 Oct 2020 21:43:06 +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 1kPYG9-0000i3-SR for pgsql-hackers@lists.postgresql.org; Mon, 05 Oct 2020 21:43:05 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kPYG7-0007z4-7D for pgsql-hackers@lists.postgresql.org; Mon, 05 Oct 2020 21:43:04 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 095Lgx2q1817290; Mon, 5 Oct 2020 17:42:59 -0400 From: Tom Lane To: Bruce Momjian cc: Julien Rouhaud , torikoshia , Atsushi Torikoshi , Tatsuro Yamada , Robert Haas , Tomas Vondra , Michael Paquier , Evgeny Efimkin , PostgreSQL Hackers Subject: Re: Feature improvement: can we add queryId for pg_catalog.pg_stat_activity view? In-reply-to: <20201005212406.GE4993@momjian.us> References: <20200314175351.pihoihvko3xgywdn@nol> <20200316144312.sxg4zwbkfmdedh36@nol> <20200402132506.z43sg7ferqgmpthz@nol> <57df2441-f036-ba75-a374-c2e993015376@nttcom.co.jp_1> <20200714112453.hxxbwobyimefxzv7@nol> <20200819141930.n33w6qbap7udm7b6@nol> <20201005212406.GE4993@momjian.us> Comments: In-reply-to Bruce Momjian message dated "Mon, 05 Oct 2020 17:24:06 -0400" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1817288.1601934179.1@sss.pgh.pa.us> Date: Mon, 05 Oct 2020 17:42:59 -0400 Message-ID: <1817289.1601934179@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Bruce Momjian writes: > I would like to apply this patch (I know it has been in the commitfest > since July 2019), but I have some questions about the user API. Does it > make sense to have a column in pg_stat_actvity and an option in > log_line_prefix that will be empty unless pg_stat_statements is > installed? Is there no clean way to move the query hash computation out > of pg_stat_statements and into the main code so the query id is always > visible? (Also, did we decide _not_ to make the pg_stat_statements > queryid always a positive value?) FWIW, I think this proposal is a mess. I was willing to hold my nose and have a queryId field in the internal Query struct without any solid consensus about what its semantics are and which extensions get to use it. Exposing it to end users seems like a bridge too far, though. In particular, I'm afraid that that will cause people to expect it to have consistent values across PG versions, or even just across architectures within one version. The larger picture here is that there's lots of room to doubt whether pg_stat_statements' decisions about what to ignore or include in the ID will be satisfactory to everybody. If that were not so, we'd just move the computation into core. regards, tom lane