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 1syD4t-00F6hu-2n for pgsql-hackers@arkaria.postgresql.org; Tue, 08 Oct 2024 16:28:51 +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 1syD4r-00AAgD-O8 for pgsql-hackers@arkaria.postgresql.org; Tue, 08 Oct 2024 16:28:49 +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.94.2) (envelope-from ) id 1syD4r-00AAeU-EE for pgsql-hackers@lists.postgresql.org; Tue, 08 Oct 2024 16:28:49 +0000 Received: from mail-wr1-x430.google.com ([2a00:1450:4864:20::430]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1syD4k-003Afe-ON for pgsql-hackers@lists.postgresql.org; Tue, 08 Oct 2024 16:28:48 +0000 Received: by mail-wr1-x430.google.com with SMTP id ffacd0b85a97d-37cd8972738so4072590f8f.3 for ; Tue, 08 Oct 2024 09:28:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1728404921; x=1729009721; darn=lists.postgresql.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=Z1HTUaMhsVzbttIwcuB9QSI3KgW6tqH5WQW7RtDvoqY=; b=FzFGZdV7MSG+aUai+3uhMct4XtPpfleTFZ29R8sUPZyt97aDRPILokmmvTI26BUTLp S/eodCD5EZNG3/1CjhAh9pPaB4Od8jxb6AGiAPFZWSdhPbOuUcxeVjN4FzB4lChy0VIZ ykmggRFVykjSeLmSjSNGyYZfQ1cAMku3J2zW48j5h6BBQzxK+/3xMDeVgUYIqz56qxun bo2o8TuN7sCL3XBEvtPqX/GP4IuntMo8poGx5Yrx+8P7cliCaqoOgT2R9uc0hxEUzDo1 c+6LEMmv1uG80PzvWjqAoLBHIyKurkrSdM/boNkSCbKzQgr9dXbOInptdRnYt5+qB20y zTyA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728404921; x=1729009721; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=Z1HTUaMhsVzbttIwcuB9QSI3KgW6tqH5WQW7RtDvoqY=; b=HPAMzvMvDmCK8M0QmwW+Q2/YpIARfpS4nnzsT3qAGmZHSiFOnEjBdU05c0lLAVM4ZN //jUQhcJy3lN4o2HVHjtMg+Do8tT4iHP//z1nypDbyaWc4/brT66Mo/RqbzCEjvIbTF6 X0GXAc2vcWoNUSDQuIyu+0gxQFeJP8nmBRuC5DlZsIL2p7f6hhzwyzb8Hv8JPBMc0QCY OuqwA8h1IKbXTqYS9kIxCjrSLQvwBNGObQyG9e8MrxsOS/TVIJSBlBeKy6A1z6f3SZql BVMu/VRrpnGOmaSuJSIIPGfToRmkH9kPpyPhBPj5pOYTLWbjUS/c4OT0LH4HLzb/kpOV uaOQ== X-Forwarded-Encrypted: i=1; AJvYcCWDy94atK/Ry+1d+peKGVl2tbJxC03YqQ424aLU/Fcsksjz/CrW+DPvqf9el9PBXt29XAfdOS6upI7EHcvc@lists.postgresql.org X-Gm-Message-State: AOJu0YzFPPbZvtvirS2C/Z+WjQBpjt4kGwlIWEiwQjvt87LjC9HlQOrF 4Na/T/kZ7YmsCTlCNHTtOP0TCmlZklxMvRvhoyqektsqdln8G5qm X-Google-Smtp-Source: AGHT+IGEbe1ltMb+ijDwO/iL4NfFJ8pRiQWKC7+ycqcq2XO38w55vNcAbPQoWOWhpx7taq8ZPvID1w== X-Received: by 2002:a5d:5350:0:b0:37d:3331:c7ed with SMTP id ffacd0b85a97d-37d3331cc2amr1335338f8f.41.1728404920963; Tue, 08 Oct 2024 09:28:40 -0700 (PDT) Received: from ip-10-97-1-34.eu-west-3.compute.internal (ec2-15-236-134-5.eu-west-3.compute.amazonaws.com. [15.236.134.5]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-37d1696f921sm8443701f8f.91.2024.10.08.09.28.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Oct 2024 09:28:40 -0700 (PDT) Date: Tue, 8 Oct 2024 16:28:39 +0000 From: Bertrand Drouvot To: Michael Paquier Cc: Nazir Bilal Yavuz , Alvaro Herrera , Kyotaro Horiguchi , pgsql-hackers@lists.postgresql.org Subject: Re: per backend I/O 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 Tue, Oct 08, 2024 at 01:46:23PM +0900, Michael Paquier wrote: > On Mon, Oct 07, 2024 at 09:54:21AM +0000, Bertrand Drouvot wrote: > > On Fri, Sep 20, 2024 at 01:26:49PM +0900, Michael Paquier wrote: > >> This would rely on the fact that we would use the ProcNumber for the > >> dshash key, and this information is not provided in pg_stat_activity. > >> Perhaps we should add this information in pg_stat_activity so as it > >> would be easily possible to do joins with a SQL function that returns > >> a SRF with all the stats associated with a given connection slot > >> (auxiliary or backend process)? > > > > I'm not sure that's needed. What has been done in the previous versions is > > to get the stats based on the pid (see pg_stat_get_backend_io()) where the > > procnumber is retrieved with something like GetNumberFromPGProc(BackendPidGetProc(pid)). > > Ah, I see. So you could just have the proc number in the key to > control the upper-bound on the number of possible stats entries in the > dshash. Yes. > Assuming that none of this data is persisted to the stats file at > shutdown and that the stats of a single entry are reset each time a > new backend reuses a previous proc slot, that would be OK by me, I > guess. > > >> The active PIDs of the live sessions are not stored in the active > >> stats, why not? > > > > That was not needed. We can still retrieve the stats based on the pid thanks > > to something like GetNumberFromPGProc(BackendPidGetProc(pid)) without having > > to actually store the pid in the stats. I think that's fine because the pid > > only matters at "display" time (pg_stat_get_backend_io()). > > Okay, per the above and the persistency of the stats. Great, I'll work on an updated patch version then. Regards, -- Bertrand Drouvot PostgreSQL Contributors Team RDS Open Source Databases Amazon Web Services: https://aws.amazon.com