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 1oTS0j-0002Dl-0g for pgsql-hackers@arkaria.postgresql.org; Wed, 31 Aug 2022 18:00:21 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1oTS0h-00015p-Sq for pgsql-hackers@arkaria.postgresql.org; Wed, 31 Aug 2022 18:00:19 +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 1oTS0h-00015g-JJ for pgsql-hackers@lists.postgresql.org; Wed, 31 Aug 2022 18:00:19 +0000 Received: from smtp-fw-33001.amazon.com ([207.171.190.10]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oTS0f-0006A2-Ba for pgsql-hackers@lists.postgresql.org; Wed, 31 Aug 2022 18:00:19 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazon201209; t=1661968817; x=1693504817; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=EVQU95DHIlh0ydHfdxoXRuOhqfz2/F4KZ0NXXCVtVZc=; b=AJrmcCt8Ca4j8ZxWbJAz8POCHiSFeDD8QMqcYNBEFdI1HuehEh2uQiJq P6HJnZUE6XNUz0zrttCCEToU/gOfTo3Zvfc+0Vde+YW7xwGFNBs+XLnH0 37YWSrDvtIrAPunvH4A4fk0kxDS+r6EajA7UPMXR1brEwPsDdr7XIVznp w=; X-IronPort-AV: E=Sophos;i="5.93,278,1654560000"; d="scan'208";a="222417927" Received: from iad12-co-svc-p1-lb1-vlan3.amazon.com (HELO email-inbound-relay-pdx-2a-6a4112b2.us-west-2.amazon.com) ([10.43.8.6]) by smtp-border-fw-33001.sea14.amazon.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 Aug 2022 18:00:13 +0000 Received: from EX13MTAUWB001.ant.amazon.com (pdx1-ws-svc-p6-lb9-vlan2.pdx.amazon.com [10.236.137.194]) by email-inbound-relay-pdx-2a-6a4112b2.us-west-2.amazon.com (Postfix) with ESMTPS id 7E41C4C0083; Wed, 31 Aug 2022 18:00:11 +0000 (UTC) Received: from EX19D018UWC004.ant.amazon.com (10.13.138.168) by EX13MTAUWB001.ant.amazon.com (10.43.161.249) with Microsoft SMTP Server (TLS) id 15.0.1497.38; Wed, 31 Aug 2022 18:00:06 +0000 Received: from [10.111.246.30] (10.43.160.191) by EX19D018UWC004.ant.amazon.com (10.13.138.168) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA) id 15.2.1118.12; Wed, 31 Aug 2022 18:00:06 +0000 Message-ID: <46ca04f9-1e37-c862-9a28-c5dffaee412f@amazon.com> Date: Wed, 31 Aug 2022 11:00:05 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.2.0 Subject: Re: [PATCH] Query Jumbling for CALL and SET utility statements Content-Language: en-US To: Andres Freund , "Drouvot, Bertrand" CC: PostgreSQL Hackers , "Schneider (AWS), Jeremy" , Peter Eisentraut , Pavel Stehule , Nikolay Samokhvalov References: <36e5bffe-e989-194f-85c8-06e7bc88e6f7@amazon.com> <20220831160839.wseeotr7rckucpmv@awork3.anarazel.de> From: Jeremy Schneider In-Reply-To: <20220831160839.wseeotr7rckucpmv@awork3.anarazel.de> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.43.160.191] X-ClientProxiedBy: EX13D21UWB003.ant.amazon.com (10.43.161.212) To EX19D018UWC004.ant.amazon.com (10.13.138.168) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 8/31/22 9:08 AM, Andres Freund wrote: > > I suspect we should carve out things like CALL, PREPARE, EXECUTE from > track_utility - it's more or less an architectural accident that they're > utility statements. It's a bit less clear that SET should be dealt with that > way. Regarding SET, the compelling use case was around "application_name" whose purpose is to provide a label in pg_stat_activity and on log lines, which can be used to improve observability and connect queries to their source in application code. Nikolay's incident (on peak shopping day for an eCommerce corp) evidently involved an application which leveraged this, but as a result the contention on the pg_stat_statements LWLock in exclusive mode effectively caused an outage for the retailer? Or nearly did? My description here is based on Nikolay's public twitter comment. I've seen a lot of applications that make heavy use of temp tables, where DDL would be pretty important to track as part of the regular workload. So that probably should be added to the list alongside prepared statements. And I'd want to spend a little more time thinking about what other use cases might be missing. I'm hesitant about the general idea of carving out some utility statements away from this "track_utility" GUC. Personally, at this point, I think pg_stat_statements is critical infrastructure for anyone running PostgreSQL at scale. The information it provides is indispensable. I don't think it's really defensible to tell people that if they want to scale, then they need to fly blind on any utility statements. -Jeremy -- Jeremy Schneider Database Engineer Amazon Web Services