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.94.2) (envelope-from ) id 1sqYZb-00AjXp-QB for pgsql-hackers@arkaria.postgresql.org; Tue, 17 Sep 2024 13:48:56 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1sqYZb-00BH6R-IS for pgsql-hackers@arkaria.postgresql.org; Tue, 17 Sep 2024 13:48:55 +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.94.2) (envelope-from ) id 1sqYYp-00BE1a-2S for pgsql-hackers@lists.postgresql.org; Tue, 17 Sep 2024 13:48:07 +0000 Received: from mail-pj1-x1033.google.com ([2607:f8b0:4864:20::1033]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1sqYYl-001epA-Mr for pgsql-hackers@lists.postgresql.org; Tue, 17 Sep 2024 13:48:06 +0000 Received: by mail-pj1-x1033.google.com with SMTP id 98e67ed59e1d1-2d8a4bad409so3872589a91.0 for ; Tue, 17 Sep 2024 06:48:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1726580883; x=1727185683; darn=lists.postgresql.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=tqb4bEqBeEjr3d4h2fqlVcBw39ulQiF7FhvP+QNoS7I=; b=BNy0GzkUQr5w8ElY6pcDdtI9ew/2HET0syA2ueEmruMUjxD/4bmQyG+ECuZVzJeece sYUY+/p+5/CNEW7P4XNTp6uOZxLy4odkIog/LoJe3ULY916zRQxRt6SNvM71lTg3eUcm gAHvw6qGdnj6s+jJzKLlmIpYxro4C4ElAtjN1mHoeThnEL/on2oRsH6Vr+M66MVNdQA6 PWEJQOujLi+PvM6gYzwcI0f8mT7l4D4rUCkjoz7ZFTxf5b/yVOUAKqYlm2DopyYZGwKZ 4sBSTO0GDZwAJpIJp/rZ00LAPANsJ8AOXH7SjLhQpdNXYNHjTEt+Q/nkowNbt9TSi+WW aT6g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726580883; x=1727185683; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=tqb4bEqBeEjr3d4h2fqlVcBw39ulQiF7FhvP+QNoS7I=; b=L6kTKIGqfOzh7nu9aB/RmYBLBYL3QM7XxbQaFvUi+djkXT+Yi8InRA33kTYjzNFDAC NimNaTW4Pu3l29K4YFFnfwRV18peLCo7uQRNs0znX8qhGuaOzh/Zihn0FKnTCJOsvvfZ p3hazNx1lMHfh+IUdbWEEV/3aohtEhiQdbXtsAe5+rnChfiB1VRquaUuZ3lsZwCmUzX3 8z1Wm//5cigHmSIEnXG8c3NibIvn4MpM1T82AfWo/gpoeL1TqtkjyacGjJeISMAiT+j9 RwhTlklv/26ibvkWWti+JNZL5nQxxhT0/I3i5LnR9Wrm86rFFDuLPqWyKjgXcewOjvFC nGeg== X-Forwarded-Encrypted: i=1; AJvYcCUJn8fNun5BKFm7ojBexHpRvsuZj+42+t+sqxK054LioflYeYQz6PTMiTS9Fsy27xOYdfpsNh0XS7sQQ+0l@lists.postgresql.org X-Gm-Message-State: AOJu0YyfK7O3HDJa+reyl0ecWU9sI2wk+oz5XZ4MzxT41S2HnPjsP8eh sULowFDZc6h7IxWv8ebTy6pjXqXiGcBSFaI9Kt0sSlpYrgHz7WAT2gwkVZ+YhzHhwqv9qK0m6qM nQRSSjUaWRrbCGGJeQuBTdPbsgaA= X-Google-Smtp-Source: AGHT+IGafxtQF5ssg3SSt1ZfyBHz3BlJ1Fxn9hR1ErIWSrystpAAbufqxAWNmK4psmGSueatm5wh7qNHiE3R3QBePhQ= X-Received: by 2002:a17:90b:4b44:b0:2d8:8c82:10a with SMTP id 98e67ed59e1d1-2db9ffb0e4emr22590085a91.5.1726580883143; Tue, 17 Sep 2024 06:48:03 -0700 (PDT) MIME-Version: 1.0 References: <202409051303.qumelxccgzzn@alvherre.pgsql> In-Reply-To: From: Nazir Bilal Yavuz Date: Tue, 17 Sep 2024 16:47:51 +0300 Message-ID: Subject: Re: per backend I/O statistics To: Bertrand Drouvot Cc: Alvaro Herrera , Kyotaro Horiguchi , pgsql-hackers@lists.postgresql.org Content-Type: text/plain; charset="UTF-8" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi, On Tue, 17 Sept 2024 at 16:07, Bertrand Drouvot wrote: > On Tue, Sep 17, 2024 at 02:52:01PM +0300, Nazir Bilal Yavuz wrote: > > Could we remove pg_stat_get_my_io() completely and use > > pg_stat_get_backend_io() with the current backend's pid to get the > > current backend's stats? > > The reason why I keep pg_stat_get_my_io() is because (as mentioned in [1]), the > statistics snapshot is build for "my backend stats" (means it depends of the > stats_fetch_consistency value). I can see use cases for that. > > OTOH, pg_stat_get_backend_io() behaves as if stats_fetch_consistency is set to > none (each execution re-fetches counters from shared memory) (see [2]). Indeed, > the snapshot is not build in each backend to copy all the others backends stats, > as 1/ I think that there is no use case (there is no need to get others backends > I/O statistics while taking care of the stats_fetch_consistency) and 2/ that > could be memory expensive depending of the number of max connections. > > So I think it's better to keep both functions as they behave differently. > > Thoughts? Yes, that is correct. Sorry, you already had explained it and I had agreed with it but I forgot. > > If you meant the same thing, please don't > > mind it. > > What I meant to say is to try to remove the duplicate code that we can find in > those 3 functions (say creating a new function that would contain the duplicate > code and make use of this new function in the 3 others). Did not look at it in > details yet. I got it, thanks for the explanation. -- Regards, Nazir Bilal Yavuz Microsoft