Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1w2S9M-000ItA-2d for pgsql-novice@arkaria.postgresql.org; Tue, 17 Mar 2026 10:59:48 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1w2S9L-000dMY-1v for pgsql-novice@arkaria.postgresql.org; Tue, 17 Mar 2026 10:59:47 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1w2S9L-000dMQ-18 for pgsql-novice@lists.postgresql.org; Tue, 17 Mar 2026 10:59:47 +0000 Received: from cc-smtpout3.netcologne.de ([89.1.8.213]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1w2S9H-00000000Ajm-0wQU for pgsql-novice@lists.postgresql.org; Tue, 17 Mar 2026 10:59:46 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=netcologne.de; s=nc1116a; t=1773745181; bh=5PyYGvTGgDUEcL3qHbTZTu2YLQWZJww5UgEg4w0vcyA=; h=Message-ID:Date:Subject:To:References:From:In-Reply-To:From; b=e8pVM06wlkSVjBP3JYLgwBniAcytCAnePWe3TSz/MUluTAbkFaxuSa8oRdCbdoMF0 7fwBhu/Qy9PLCN1hxQ94AGejJ3Sz5i8P4KCEmST3J88Nf2TDTsApluf+sDUPZwnNXc v0jf1FGgKwILEfNdJHIH0DImY+X9eCzURJuUBPEQj3SOXRvi3HQMqRYZzwoPAN+euT 5bGfAz6g+4iIw2AuGl2XsrMwarYon2Wq14BOwA3/ChhrB/aw3Qj+P0r+kXStu0cFXb N7XhHp3c0mIFdKjkLDzgSGzz2+jM5fn8k+ueK9y+2sTcFC+I4u6tHbpjY3PMNZ5KPn DwDqYcjBG3w5Q== Received: from cc-smtpin2.netcologne.de (cc-smtpin2.netcologne.de [89.1.8.202]) by cc-smtpout3.netcologne.de (Postfix) with ESMTP id 3F909122FA for ; Tue, 17 Mar 2026 11:59:41 +0100 (CET) Received: from [IPV6:2a03:b580:aff7:d901:d2:923d:27d5:50d1] (unknown [IPv6:2a03:b580:aff7:d901:d2:923d:27d5:50d1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by cc-smtpin2.netcologne.de (Postfix) with ESMTPSA id 2084611DC0 for ; Tue, 17 Mar 2026 11:59:41 +0100 (CET) Message-ID: Date: Tue, 17 Mar 2026 11:59:50 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: AW: Is it possible to turn on pg_stat_extensions at a database level To: pgsql-novice@lists.postgresql.org References: <959ecf128e514007a7558febe8b76e35@alte-leipziger.de> Content-Language: en-US From: vrms In-Reply-To: <959ecf128e514007a7558febe8b76e35@alte-leipziger.de> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-NetCologne-Spam: L List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk As far as I understand the matter the extension starts gathering statistical information on statements in all databases of a cluster once 'pg_stat_statments' is mentioned in the 'shared_preload_libraries' setting (including all overhead coming with it) and does nothing without it. CREATE EXTENSION pg_stat_statements just adds the view to look at these, based on the WHERE clauses mentioned already. It does not even have to be created inside that database you want to use it for. all best Gunnar On 3/12/26 10:33, Subramanian,Ramachandran wrote: > Yes, I mistyped . > > Pg_stat_statements. > > I meant to ask if the extension can be created only for one database, so that the details from the other databases are not recorded. > > LG > > Ram > > > > > > Freundliche Grüße > > i. A. Ramachandran Subramanian > Zentralbereich Informationstechnologie > > Alte Leipziger Lebensversicherung a.G. > > > Hallesche Krankenversicherung a.G. > > > > > > > > Alte Leipziger Lebensversicherung a.G., Alte Leipziger-Platz 1, 61440 Oberursel > Vors. des Aufsichtsrats: Dr. Walter Botermann · Vorstand: Christoph Bohn (Vors.), Dr. Jürgen Bierbaum (stv. Vors.), Frank Kettnaker, Dr. Jochen Kriegmeier, Alexander Mayer, Christian Pape, Wiltrud Pekarek, Udo Wilcsek > Sitz Oberursel (Taunus) · Rechtsform VVaG · Amtsgericht Bad Homburg v. d. H. HRB 1583 · USt.-IdNr. DE 114106814 > > > > > > > Hallesche Krankenversicherung a.G., Löffelstraße 34-38, 70597 Stuttgart > Vors. des Aufsichtsrats: Dr. Walter Botermann · Vorstand: Christoph Bohn (Vors.), Dr. Jürgen Bierbaum (stv. Vors.), Frank Kettnaker, Dr. Jochen Kriegmeier, Alexander Mayer, Christian Pape, > Wiltrud Pekarek, Udo Wilcsek > Sitz Stuttgart · Rechtsform VVaG · Amtsgericht Stuttgart HRB 2686 · USt.-IdNr. DE 147802285 > Beiträge zu privaten Kranken- und Pflegekrankenversicherungen unterliegen nicht der Versicherungsteuer (§ 4 Nr. 5 VersStG) · Versicherungsleistungen sowie Umsätze aus Versicherungsvertreter-/Maklertätigkeiten sind umsatzsteuerfrei > > > > > > Die Pflichtangaben der ALH Gruppe gemäß § 35a GmbHG bzw. § 80 AktG finden Sie hier: https://www.alte-leipziger.de/impressum > > > > > > ______________________ > > ALH Gruppe > Alte Leipziger-Platz 1, 61440 Oberursel > Tel.: +49 (6171) 66-4882 > Fax: +49 (6171) 66-800-4882 > E-Mail: ramachandran.subramanian@alte-leipziger.de > www.alte-leipziger.de > www.hallesche.de > > > > -----Ursprüngliche Nachricht----- > Von: depesz@depesz.com > Gesendet: Donnerstag, 12. März 2026 10:30 > An: Subramanian,Ramachandran IT-md-db > Cc: pgsql-novice@lists.postgresql.org > Betreff: Re: Is it possible to turn on pg_stat_extensions at a database level > > On Thu, Mar 12, 2026 at 08:54:04AM +0000, Subramanian,Ramachandran wrote: >> I have turned on pg_stat_extension for an instance. This instance has many databases. I want to confine the statistics to only one database. >> Is it possible to do this? > Do you mean pg_stat_statements? > > If no - sorry, never heard of pg_stat_extension. > > If yes - nope. stats are global. You can limit what you're analysing from stats by adding appropriate where condition, like: > > SELECT > * > FROM > pg_stat_statements AS pss > JOIN pg_database AS d ON pss.dbid = d.oid WHERE > d.datname = 'postgres'; > > Best regards, > > depesz >