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 1lUM6n-0008Qa-Fa for pgsql-hackers@arkaria.postgresql.org; Thu, 08 Apr 2021 04:17:33 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lUM6l-00067G-RX for pgsql-hackers@arkaria.postgresql.org; Thu, 08 Apr 2021 04:17:31 +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 1lUM6l-00064J-KM for pgsql-hackers@lists.postgresql.org; Thu, 08 Apr 2021 04:17:31 +0000 Received: from mail-pj1-x1035.google.com ([2607:f8b0:4864:20::1035]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1lUM6j-0000eg-8v for pgsql-hackers@lists.postgresql.org; Thu, 08 Apr 2021 04:17:30 +0000 Received: by mail-pj1-x1035.google.com with SMTP id k23-20020a17090a5917b02901043e35ad4aso2419702pji.3 for ; Wed, 07 Apr 2021 21:17:28 -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=M2ZzCWAHUteS2425s6dm6QHmanwvzIqeEBEadyWA3rk=; b=Lb4P5V/HiiTQrPTUeY6NsICHFtI5L2kXzcCywV99GT5x+K+uy7cuWaveAE1wQfcJeY NGBLg1a1e76msf2kPsp/cxCPGSrD4awVO+D+2r0bcITNFq67xku3grfQn3uxhGtvVnHS Y2/Ro6zBO//1bGNm9OZXLomHwUvFWZMarEbjRK/wiJN4GL/8iPV8J41ZKkBbEympS9pi CVIaW2r5rkwy/Jsf4CNDV/+OQ5iuC8IHyUKQufxyHhcgsip6TXyjWUzzYvdlv21hukcF 7VZqoO9zang2LusAEQWmkyJVekRNNOUHxpVvKNDr9vAKL+OdQMPSeYXQUG9xQJOkv3KX wXKw== 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=M2ZzCWAHUteS2425s6dm6QHmanwvzIqeEBEadyWA3rk=; b=FIGtYCtdQ7a712RirXZTtCoksCSJmzovaAkGhxToiui6ulXvNDr0kNcyzmdfztUD1m JHC1Ell+Me3ktANZc+obDS6l8V+24uEaMEr7/ywIQa5AEuIKfevAQjWqzOcDaGYiZApc R39hx/0SO8jC/cgVmru48VzlFU/wVb+2wHkzBVApv/tIVPejblxegng4Mqd/aRNS0bon EVTTpUnYws/NQBN4QxWriMwkPMlMM+d+EvrCxevGyRHYdHwdLATSTBQqwky+eGA61Xh4 ue6KzM//BAKwjJEjGAHDCDn8zXZc26B5Cuefy/5Kxp/Mx2VF+wJcizU4wTyoJ998QAVp aDsg== X-Gm-Message-State: AOAM5323BTGKB9ZaL8xWVS1tJgGQ6lKc6jLV6XkRGjUQEhuR2/Eu4a6x U+GeOIrYNlqBszeXsj/S0b8= X-Google-Smtp-Source: ABdhPJzoU1kOPA/0nzt/Te8bSqXlDOqgtzSwh2aJWR2xDkyRAJ4+r4F49wXMn5apwLgxxk/u/xTY5g== X-Received: by 2002:a17:90a:fb48:: with SMTP id iq8mr6540427pjb.105.1617855447723; Wed, 07 Apr 2021 21:17:27 -0700 (PDT) Received: from nol (2001-b011-0008-9647-4c71-2a6f-a895-f450.dynamic-ip6.hinet.net. [2001:b011:8:9647:4c71:2a6f:a895:f450]) by smtp.gmail.com with ESMTPSA id pg11sm5683021pjb.53.2021.04.07.21.17.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Apr 2021 21:17:26 -0700 (PDT) Date: Thu, 8 Apr 2021 12:17:58 +0800 From: Julien Rouhaud To: Bruce Momjian Cc: Nitin Jadhav , Alvaro Herrera , Hannu Krosing , Robert Haas , Pavel Stehule , Tom Lane , Michael Paquier , torikoshia , Atsushi Torikoshi , Tatsuro Yamada , Tomas Vondra , Evgeny Efimkin , PostgreSQL Hackers Subject: Re: Feature improvement: can we add queryId for pg_catalog.pg_stat_activity view? Message-ID: <20210408041758.amzavdu5rmvv6low@nol> References: <20210401182802.d7o632hxdgwita32@nol> <20210401192711.GD18031@momjian.us> <20210402053328.adqgua4fbjyx6ber@nol> <20210404141850.6nalgsl7otbt3hri@nol> <20210405171627.GA12179@momjian.us> <20210406151102.b2ytqji4m6wfhraf@nol> <20210407125726.tkvjdbw76hxnpwfi@nol> <20210407181211.GB24239@momjian.us> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210407181211.GB24239@momjian.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Wed, Apr 07, 2021 at 02:12:11PM -0400, Bruce Momjian wrote: > > Patch applied. I am ready to adjust this with any improvements people > might have. Thank you for all the good feedback we got on this, and I > know many users have waited a long time for this feature. Thanks a lot Bruce and everyone! I hope that the users who waited a long time for this will find everything they need. Just to validate that this patchset also allows user to use pg_stat_statements, any additional third-party module and the new added infrastructure with the queryid algorithm of their choice, I created a POC extension ([1]) which works as expected. Basically: SHOW shared_preload_libraries; shared_preload_libraries -------------------------- pg_stat_statements, pg_queryid (1 row) SET pg_queryid.use_object_names TO on; SET pg_queryid.ignore_schema TO on; CREATE SCHEMA ns1; CREATE TABLE ns1.tbl1(id integer); CREATE SCHEMA ns2; CREATE TABLE ns2.tbl1(id integer); SET search_path TO ns1; SELECT COUNT(*) FROM tbl1; SET search_path TO ns2; SELECT COUNT(*) FROM tbl1; SELECT queryid, query, calls FROM public.pg_stat_statements WHERE query LIKE '%tbl%'; queryid | query | calls ---------------------+---------------------------+------- 4629593225724429059 | SELECT count(*) from tbl1 | 2 (1 row) So whether that's a good idea to do that or not, users now have a choice. [1]: https://github.com/rjuju/pg_queryid