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 1whWgq-000HSr-0O for pgsql-hackers@arkaria.postgresql.org; Wed, 08 Jul 2026 18:08:08 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1whWgn-008c5w-0P for pgsql-hackers@arkaria.postgresql.org; Wed, 08 Jul 2026 18:08:05 +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 1whWgm-008c5V-1N for pgsql-hackers@lists.postgresql.org; Wed, 08 Jul 2026 18:08:05 +0000 Received: from fout-a7-smtp.messagingengine.com ([103.168.172.150]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1whWgk-00000000C4X-1zQx for pgsql-hackers@lists.postgresql.org; Wed, 08 Jul 2026 18:08:04 +0000 Received: from phl-compute-02.internal (phl-compute-02.internal [10.202.2.42]) by mailfout.phl.internal (Postfix) with ESMTP id 57818EC01F9; Wed, 8 Jul 2026 14:08:01 -0400 (EDT) Received: from phl-frontend-04 ([10.202.2.163]) by phl-compute-02.internal (MEProxy); Wed, 08 Jul 2026 14:08:01 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=anarazel.de; h= cc:cc: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=fm2; t=1783534081; x=1783620481; bh=tUPgYJsdm9 SvfnviRU0hjHobdLI6qCpVxd2H7DqbvnE=; b=fh5nR2b0Xoe8Q0Nj7j0aRdKNER 2iNcvsyybe/ja/iuvO2XIH2rdf4QM8gyUsfJNRnBoQaaDW47kdzfzBaOJfCbRO1f HNsVn2GAtMHKkD+raAD5PC202pTpWzxQrC0rDeSOalai1HODcyioUeFMAtN47mst sco3MPe2cj63nYbajY4w1w8m7X2AJ54WUiw0byVp4/JiHonzcaWpbN37uwyP6kkP QcN7iRQTAJxtUrTIwHQE4ZAy8a8eEtkWWneR32BPMN/YFI41Z2lS3JLwPf1wy6PM 7nUAVESBVDcp+B7nsiYtOVyTBV42pksVqRfoYCSvrIZ2AKL/34R0MeWTGDCg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc: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= 1783534081; x=1783620481; bh=tUPgYJsdm9SvfnviRU0hjHobdLI6qCpVxd2 H7DqbvnE=; b=Jg2Cf5waLlITw+5uMnMkcjbQvXPgHv7yPmtfa1hdCdqrU21LVdw CyKIKJDh36pDliF6AbLugothsXLrjyMDqNpIxkb/dtWUtNHHDvaiEzughKWkeeVX HBAi/Xs2rTKANydF0WsCc1jI+yEdc3yqLWGZPf0FWH92EmkpTRYa3OdAV0/2/9E0 Afxo8Ehv5O8h1gAy77YLBBMGUUJ8B3WmofXYwOG2rMAFwmtfjDVMCDPWZ/3isjJ2 q9W2qFYwpFN3rQUpLD36bFcYyb/KABuNNyc3cTcAYsS4/D3KNiYO4Gu/nYg0WbYX neaoGB1Scz5IGys+Cnyt8D+tlG2ldxEviCA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: dmFkZTG2BxEb4QNotQ1NkJrMhNa+NDWBJ1smgrgvW25AMkPPS+G31esn/6I/ZwCAA95OnL A/Zt7Oq1xCl9lBH4sZ4CibSGPqf5n3frY+rspN2eufSclFKJaukfCmfwWf2JPMCfW5/MaU +tmaTqZU/RJYfiCRiURyAkgYsZYgRsVbTwaMihGKBzDHmx74ea6UWZfJqjgpQ96kRigQ2h b44vwEaX0GkqYy3Sros7cN+yMymvbifppod77npTHFJZQKJuVsdlJlRAerxlNiXnemhrzG Do+FxAKOxbEzH2FPlao0v54xLOpBz7KppuQ5XnEAcouPNKA/WHCY/CwJszwlvMplT/F9jq tzgaE8nfgPSImvcwgQohFQeyLjDOAuKqD4zdScHgM3T5F3yl5Yfgz4mjTwgbCFGrrbckUI X5Pl7nH6BcXeE1/8yRoBqboyWuymoFliNxSxDlxnoo+mfoeajAuDhaAsU0k768h2fWh5Md qyyqr1koIEoO4Wiiqn6MEGtfAZ+HQ58qT+x2AzG3cswobD//4GvXHtQowmg+bBMIjT4PU3 n4df65i1Wd9yQRjy6hteDJdHzyQP7lZysF/pd6ziJzZQnn9OOlEekIZCumqYTCFMEaMoJK WXcvKwfVbGAVl/xZhc+imZ/JajF0XUgd3vkFLjXSDYU8cRCXCAgqWZ3ggm8w X-ME-Proxy: Feedback-ID: id4a34324:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 8 Jul 2026 14:08:00 -0400 (EDT) Date: Wed, 8 Jul 2026 14:08:00 -0400 From: Andres Freund To: Michael Paquier Cc: Bertrand Drouvot , pgsql-hackers@lists.postgresql.org Subject: Re: Add per-backend AIO statistics Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi, On 2026-07-08 15:52:20 +0900, Michael Paquier wrote: > On Tue, Jul 07, 2026 at 11:02:03AM +0000, Bertrand Drouvot wrote: > > 1/ pg_aios that lists all AIO handles that are currently in use. That shows > > what's happening right now, but not what has happened. > > > > 2/ pg_stat_get_backend_io() that shows how much IO was done, but not how it > > was done. There's no way to see whether IOs ran synchronously or > > asynchronously, whether a backend was stalling on handle exhaustion, or how > > completions are distributed across backends. > > While the information may be useful, one thing that sounds very > important to me is how this impacts workloads by default. > Andres is usually able to catch bottlenecks that everybody else is > unable to see, so perhaps checking with him the location of these > extra function calls would be a good first step. Your proposal goes > down to pgaio_io_stage(), pgaio_io_process_completion() and > pgaio_submit_staged() to track these counter increments. I think the overhead might be ok, but I am rather doubtful that all of this information is actually useful. You're adding quite a few counters for each IO, do we actually need that? E.g. what do we gain from counting: - started (if you want to see the number of IOs that are in progress, cumulative stats are the wrong tool) - executed_async (that's just the number of IOs minus executed_sync) - completed_self (that's just the number of IOs minus executed_other) Separately, I'm doubtful it makes sense to have only per-backend stats for this. I think you'd almost always want the stats for exited backend (e.g. parallel workers) too. Unfortunately I'm pretty doubtful that pgstat_backend.c is the right architectural direction. It'll just end up implementing all kinds of stats, since we'll incrementally want more and more per-backend stats. I think what we'd want is rather something where for each applicable stats kind we have a shared counter for all exited backends and then per-backend counters for live backends, with helpers to aggregate the exited + live stats to a total. Greetings, Andres Freund