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 1v3XF3-0009Ti-BA for pgsql-hackers@arkaria.postgresql.org; Tue, 30 Sep 2025 10:05:53 +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 1v3XEz-008Uf9-VQ for pgsql-hackers@arkaria.postgresql.org; Tue, 30 Sep 2025 10:05:50 +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 1v3XEz-008Uf0-Lv for pgsql-hackers@lists.postgresql.org; Tue, 30 Sep 2025 10:05:50 +0000 Received: from mail-wr1-x430.google.com ([2a00:1450:4864:20::430]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1v3XEw-000sYa-0F for pgsql-hackers@lists.postgresql.org; Tue, 30 Sep 2025 10:05:48 +0000 Received: by mail-wr1-x430.google.com with SMTP id ffacd0b85a97d-3ecdf2b1751so3819773f8f.0 for ; Tue, 30 Sep 2025 03:05:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1759226745; x=1759831545; 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=H5K58skFtZj48nFS1M0hemhArmou4g/mh6dNJnM8Pc0=; b=hZEzjggb2VOhEYEFEdfHH+JLfI1fGIxY1FhzfWwyen6jPLrlv4moR0aF2RP0UkXfIU gTcAJysSK2+p2c8QfWFxZYrbVbZKqcrLlKGOfjMTt6X371NjywMCDMhDcQgjh8P6kREL icRzF+o6IaAeiCz15ib1eqqAHYxZaaDFd/7V6tui7Yeoj1iQmeTSaDQIN9DmboYAR8xU rGdJyzl3eGdp4FOAleNkNhUwoOubX3rilbuv69dFifqA7D2Ggr+NuP6Tuu7v0SPvUS1p SqhGIe2GhWN/Y40Wzba+1H00yL7LWA0Fh3sXz4jtPP0YGn93FI6fR/WM570R3BNTPw/r SoeA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1759226745; x=1759831545; 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=H5K58skFtZj48nFS1M0hemhArmou4g/mh6dNJnM8Pc0=; b=GRW1AQn4WdyDlIe/6SX22FIrTrVbNkMwystwms4TtYIjwZpkPwQzGIQcB88IBB4nxT WvZzUMRxSf1KZFrEfv54SgSg5E7IwXFodo/5E7lL+/pvzM3TGySxrydOylppe1bam4il 14t24V78VV+vQyz1rgwVjayB8d8IkXYsR5Lu9qFW2ewl/GDuCXnewMTInU7Jljt7tWzH SIZBMA5+iAXFCpDUW/0zk3+AVD2VR7tlOqZvA25gpX+DTcxwfyOU2DNrOuvYrDPmgXqU 86lNipD08HT2sg4OYqNqSeUWZVoOBMRIY111oLyqmdrdNfFECeTAMwM6ZGkSlI9RbsU1 vXVw== X-Forwarded-Encrypted: i=1; AJvYcCVL6puEvFf2eXYfcL+0370Y9TcPT5Fnv5ylm8uu8gqLlicT8Q2UBDDgX8yKjJgH2BfRi8GR2KHMyRhwUBqB@lists.postgresql.org X-Gm-Message-State: AOJu0Yy4fYHMKyLe8FHIcuXai2nXOHfK8FEhKNl/sJ2imEW+giD/gklZ IO87rM+z0fWyxByRucDy6bDE0HyqxLJzsCp3Qu9WRdvQkYT6PcCK2p7R X-Gm-Gg: ASbGncv0RsV29Od8s7MXDv4EF1AwWeGmq2objBrAodx3TBA+tSFaJKobdEz4FP7LYVj 5YgHVPbpuJejA3eDWMrubSk99pCDHP/XU1Oh2I/SQfVah2OrWqEdD2NUVuPjJV/ZaMmWX3G0k/O 3LgqSc3YUds0xiiTXmrjwp1mJRpVVbR4TQDk+CPHxYpMk0CD7sZjkF+taYWU36qCJiGKBX4OqsU 1Wwtn678YDRXCOcPOAPJThc2Mo0vHRdMLBD6x5u9WRAYIIA4TjjvA2c9aj6S0AH04xHud9fE/eA 0RZ4n4jJPCDQGVnpehwfnt/LN5OxH7qfex6fPSkX6/hhaeQBgYrrOYBj8xpwno85picPEsNTgIc xzud4b1ejMmoDLhMpGpGHzTIgf6cOlKKUaRbkoXlY6q81AJIqTPVADCfaVMlZOdyUkvXnjUfCXl jPRUv/oNNGVGe7V0G8T06HSWrSd9FL64LcUXbiObQ5XXOO+oP9D+2aFtdA28GfJP4YsyB4qkNA5 21rPA== X-Google-Smtp-Source: AGHT+IHV2DSHXtWT9KuNd/M28Vlid1Rft98CI5yLx+p+2szvUdUrkfq+ziP9iUvta995J211bj3rAQ== X-Received: by 2002:a05:6000:2282:b0:3ee:1586:6c85 with SMTP id ffacd0b85a97d-40e50d6de49mr17098464f8f.57.1759226744838; Tue, 30 Sep 2025 03:05:44 -0700 (PDT) Received: from ip-10-97-1-34.eu-west-3.compute.internal (ec2-15-237-181-182.eu-west-3.compute.amazonaws.com. [15.237.181.182]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-40fb72fb2eesm22591168f8f.12.2025.09.30.03.05.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Sep 2025 03:05:44 -0700 (PDT) Date: Tue, 30 Sep 2025 10:05:43 +0000 From: Bertrand Drouvot To: Michael Paquier Cc: Andres Freund , pgsql-hackers@lists.postgresql.org Subject: Re: [BUG]: the walsender does not update its IO statistics until it exits 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, Sep 30, 2025 at 04:37:25PM +0900, Michael Paquier wrote: > On Tue, Sep 30, 2025 at 07:14:14AM +0000, Bertrand Drouvot wrote: > > On Thu, Feb 27, 2025 at 12:09:46PM +0900, Michael Paquier wrote: > >> Agreed that something in the lines of non-transaction update of the > >> entries could be adapted in some cases, so +1 for the idea. I suspect > >> that there would be cases where a single stats kind should be able to > >> handle both transactional and non-transactional flush cases. > >> Splitting that across two stats kinds would lead to a lot of > >> duplication. > > > > One option could be to use 2 pending lists for the variables stats and 2 flush > > callbacks for fixed stats. Thoughts? > > Hmm. I would have thought first about one pending area, and two > callbacks for the variable-sized stats, called with a different > timing because the stats to be flushed are the same aren't they? For > example, if we are in a long analytical query, we would flush the IO > stats periodically, reset the pending data, repeat/rinse periodically, > and do a last round when we are done with the query in postgres.c. > > Do we really need a second callback by the way? It could be as well > the same flush callback, with an option to mark stats kinds that allow > a periodic flush. The trick is knowing where the new reports calls > should happen. The executor is the primary target area. > > Or perhaps you think that the pending data of a stats kind could be > different if a kind allows transactional and non-transactional > flushes? Yeah that was my thought: one stats kind could have metrics that are transactional and some metrics that are non-transactional. This could be possible for both variable and fixed stats, that's why I was thinking about having 2 pending lists for the variables stats and 2 flush callbacks for fixed stats. Regards, -- Bertrand Drouvot PostgreSQL Contributors Team RDS Open Source Databases Amazon Web Services: https://aws.amazon.com