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 1vibYF-00AtwF-2w for pgsql-general@arkaria.postgresql.org; Wed, 21 Jan 2026 16:59:28 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vibYE-008F9H-1E for pgsql-general@arkaria.postgresql.org; Wed, 21 Jan 2026 16:59:26 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vibYD-008F94-0v for pgsql-general@lists.postgresql.org; Wed, 21 Jan 2026 16:59:26 +0000 Received: from fout-a1-smtp.messagingengine.com ([103.168.172.144]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vibYA-001kg1-0U for pgsql-general@lists.postgresql.org; Wed, 21 Jan 2026 16:59:25 +0000 Received: from phl-compute-02.internal (phl-compute-02.internal [10.202.2.42]) by mailfout.phl.internal (Postfix) with ESMTP id F389BEC01D5; Wed, 21 Jan 2026 11:59:18 -0500 (EST) Received: from phl-frontend-04 ([10.202.2.163]) by phl-compute-02.internal (MEProxy); Wed, 21 Jan 2026 11:59:18 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= cc:cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm1; t=1769014758; x=1769101158; bh=cmhsGeA8kAgEnAdu1zkvl251fsol5JSFjt7pvLQJGj8=; b= NFbNdiZPz4sT18d2InNH+mPM7jjqXWRDSXZMQC42RUPpqdmvXIyeP/4lJafQvY/d icPGnzMkoxUEaqt7RHFATeJJzuyrMfkovTT2Q2s6GuZdfQ15lUToF6WnnM/YleX7 25eKEOGoGA6XF2UCCWBFqD6wgT/JK+zSedcQVNPxeO9097FUVMtSQie/nDbOWK47 DfPi6MvAhExNsWJ0zraitsfJtk5/Tf/jKPGvMDGzZx325CXFrhC9B09z7aZ+w94m bXZQX04zfkmQpXUtUVsUWBUzoDQoyO/JLgwFyGILhFmy9y/kHn9cF/dmBnHGScLG Zkh843goqFmLEl1yDpSomQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t=1769014758; x= 1769101158; bh=cmhsGeA8kAgEnAdu1zkvl251fsol5JSFjt7pvLQJGj8=; b=r 3naqVdXiFrjjkuVv6hS0dANDydyUlynT67eJMSmJLIld3IpvaonKjmV/cv9FIxZQ wx8phktqb/Ubz6Jbh7JfB13qXo6tyybI3QH5FmSBb47qMedRUqyM3iWrI5Xf1V/5 GmngMaTWHOumOI2N1ksjPFnmgeX9f8BfFQJBZHLX8QlD8vkd+zAheCWACZGOe4ik aICAyGwafgNbr3XKb/OKmau+SopdLAXUiLqkx7eWeCbOzMWgayanyfxslcS2w6im Lb12JC5CkcmI4q/q/4CalJOqjX5ZmmWVLlnLhQXIrtzLXotzDISLPONiqpS1s9kn syEvD0xhRIQt1UOr0ZNKw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgddugeefkedvucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujf gurhepkfffgggfuffvvehfhfgjtgfgsehtjeertddtvdejnecuhfhrohhmpeetughrihgr nhcumfhlrghvvghruceorggurhhirghnrdhklhgrvhgvrhesrghklhgrvhgvrhdrtghomh eqnecuggftrfgrthhtvghrnhepjeeutdfgieehfeeuvefhkeekleejgedutdevvdelgeei vdfhudduvdethffhleffnecuffhomhgrihhnpehgihhthhhusgdrtghomhenucevlhhush htvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegrughrihgrnhdrkhhl rghvvghrsegrkhhlrghvvghrrdgtohhmpdhnsggprhgtphhtthhopedvpdhmohguvgepsh hmthhpohhuthdprhgtphhtthhopegtohhlihhnthhhrghrthesghhmrghilhdrtghomhdp rhgtphhtthhopehpghhsqhhlqdhgvghnvghrrghlsehlihhsthhsrdhpohhsthhgrhgvsh hqlhdrohhrgh X-ME-Proxy: Feedback-ID: i76984098:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 21 Jan 2026 11:59:18 -0500 (EST) Message-ID: <1013bd5d-5356-497b-ae06-c02dc53caf92@aklaver.com> Date: Wed, 21 Jan 2026 08:59:17 -0800 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: pgBadger and postgres_fdw To: Colin 't Hart Cc: PostgreSQL General References: <31af308b-1689-44e8-ab88-f6a72722b38b@aklaver.com> Content-Language: en-US From: Adrian Klaver In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 1/21/26 08:12, Colin 't Hart wrote: > 6. The 19 slowest queries in a 4 hour period are between 2 and 37 > minutes, with an average of over 10 minutes; they are all `fetch 100 > from c2`. > > The slowness itself isn't my question here; it was caused by having too > few cores in the new environment, while the application was still > assuming the higher core count and generating too many concurrent processes. > > My question is how to identify which connections / queries from > postgres_fdw are generating the `fetch 100 from c2` queries, which, in > turn, may quite possibly lead to a feature request for having these > named uniquely. My guess not. See: https://github.com/postgres/postgres/blob/master/contrib/postgres_fdw/postgres_fdw.c Starting at line ~5212 fetch_size = 100; and ending at line ~5234 /* Construct command to fetch rows from remote. */ snprintf(fetch_sql, sizeof(fetch_sql), "FETCH %d FROM c%u", fetch_size, cursor_number); So c2 is a cursor number. > > Thanks, > > Colin > -- Adrian Klaver adrian.klaver@aklaver.com