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 1sqWkl-00ATWp-85 for pgsql-hackers@arkaria.postgresql.org; Tue, 17 Sep 2024 11:52:20 +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 1sqWkj-009eF1-Px for pgsql-hackers@arkaria.postgresql.org; Tue, 17 Sep 2024 11:52:17 +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 1sqWkj-009eEo-Fm for pgsql-hackers@lists.postgresql.org; Tue, 17 Sep 2024 11:52:17 +0000 Received: from mail-pf1-x433.google.com ([2607:f8b0:4864:20::433]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1sqWkg-001dGG-OV for pgsql-hackers@lists.postgresql.org; Tue, 17 Sep 2024 11:52:16 +0000 Received: by mail-pf1-x433.google.com with SMTP id d2e1a72fcca58-7178df70f28so4174760b3a.2 for ; Tue, 17 Sep 2024 04:52:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1726573933; x=1727178733; 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=54X8rbuFkaR4I3aviGXU+JCRHE3ZbkwjpqGih8uCw/I=; b=gQA5WNJ5myo8b1609IzJMq19Sq77TGou6N7769UXPkWHDrReHZnJ8UXzM3ao0JkQwB 2cCOcxEAPSVMTRwzxBn+lsQgnKluB5tsuTZjlrNhetHQ4Bpidly/ytbO6lnbO/FwljXo AsZhTvTj3UbvgdiRG1cSUgpaPlMYBRYmHxnGLD6g58SRAwirqpQGMQ+KIBvX+zIePHvP bdE/mGy8aDGrZDFLfNw0hB5xXiKkOi61jHaMVkHw97cb9CSkaa+6B5H3wAYwtjrHs9qB 8MdQ5eNzKV5eKQ7V+oFPjVRFGS69szXm4Hcj++htJuD+ZqO5WBQLvHddEqPH6JSXd70O +Avg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726573933; x=1727178733; 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=54X8rbuFkaR4I3aviGXU+JCRHE3ZbkwjpqGih8uCw/I=; b=wavChrdfHgAgij7nHuAXiCw8KPsh2X4lv590SrUm2TsY3x0yjobjCzJUR2TWeyN5zN fZYgqmLE0QIgBoJVJ2rr6Owc4kuWmzzpH6TZy1Y4E3KvtTcc0/cWG/HbHxV6KYs9jYLw FW8BHyTts0yJtqmPuadH2WETRm4xZv/8DjyOg03TVS3iTDYaejMGfAtaYXZzmJdFQTSS h/tbcxJfkN0rNALRLuvyPkNTsDe6fAZWdeABu3VC1h/7FvqdYDEphBqV7Tkjhyfn2N5+ c4NqnEeaLReBx1Zic+DsOVTOTXbAXnYlBlBYayXxPyoxvdT8k17TrKmPHmIPNT50Nzr6 kzHw== X-Forwarded-Encrypted: i=1; AJvYcCWebqrtr5lkklIaE+Ph8KaM1jbxPlIc1M07RsqfYhUjnKQL2Dwf7vrK8r0WGRo5shPZSZInTjVZ7it6iWiU@lists.postgresql.org X-Gm-Message-State: AOJu0Yz9fbL6rtCo0GtmMnjvPa8sEu8lTC9ei/WhtQpg2DexpwvjF7T1 eMaD4XQkKnCv2Ztm24CifWmgC4wXbuQUtlCgW98RhUB9+qF7zfdhzu2/nyFkYmxuI2UsquRJuxu vnHQChy9lnqhU+bU/jrsW+SHdNLs= X-Google-Smtp-Source: AGHT+IE8FhzQohXRP38fW9xmjMMko1G7yYVFaitlHydXbBwHVPM6XhUL0WFEboVu2jfYYjRUuo9aA5OVlMNoOJ95/g4= X-Received: by 2002:a05:6a20:ac43:b0:1cf:36f2:21e9 with SMTP id adf61e73a8af0-1cf76358fdfmr25342400637.32.1726573933434; Tue, 17 Sep 2024 04:52:13 -0700 (PDT) MIME-Version: 1.0 References: <202409051303.qumelxccgzzn@alvherre.pgsql> In-Reply-To: From: Nazir Bilal Yavuz Date: Tue, 17 Sep 2024 14:52:01 +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 Fri, 13 Sept 2024 at 19:09, Bertrand Drouvot wrote: > On Fri, Sep 13, 2024 at 04:45:08PM +0300, Nazir Bilal Yavuz wrote: > > - The pgstat_reset_io_counter_internal() is called in the > > pgstat_shutdown_hook(). This causes the stats_reset column showing the > > termination time of the old backend when its proc num is reassigned to > > a new backend. > > doh! Nice catch, thanks! > > And also new backends that are not re-using a previous "existing" process slot > are getting the last reset time (if any). So the right place to fix this is in > pgstat_io_init_backend_cb(): done in v4 attached. v4 also sets the reset time to > 0 in pgstat_shutdown_hook() (but that's not necessary though, that's just to be > right "conceptually" speaking). Thanks, I confirm that it is fixed. You mentioned some refactoring upthread: On Fri, 6 Sept 2024 at 18:03, Bertrand Drouvot wrote: > > - If we agree on the current proposal then I'll do some refactoring in > pg_stat_get_backend_io(), pg_stat_get_my_io() and pg_stat_get_io() to avoid > duplicated code (it's not done yet to ease the review). 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? If you meant the same thing, please don't mind it. -- Regards, Nazir Bilal Yavuz Microsoft