Re: Show WAL write and fsync stats in pg_stat_io

2024-05-13 Thread Bharath Rupireddy
On Fri, Apr 19, 2024 at 1:32 PM Nazir Bilal Yavuz wrote: > > > I wanted to inform you that the 73f0a13266 commit changed all WALRead > > calls to read variable bytes, only the WAL receiver was reading > > variable bytes before. > > I want to start working on this again if possible. I will try to

Re: Show WAL write and fsync stats in pg_stat_io

2024-04-24 Thread Nazir Bilal Yavuz
Hi, On Fri, 19 Apr 2024 at 11:01, Nazir Bilal Yavuz wrote: > > On Thu, 18 Jan 2024 at 04:22, Michael Paquier wrote: > > > > > > On Wed, Jan 17, 2024 at 03:20:39PM +0300, Nazir Bilal Yavuz wrote: > > > > I agree with your points. While the other I/O related work is > > > > happening we can

Re: Show WAL write and fsync stats in pg_stat_io

2024-04-19 Thread Nazir Bilal Yavuz
Hi, On Mon, 19 Feb 2024 at 10:28, Nazir Bilal Yavuz wrote: > > Hi, > > On Thu, 18 Jan 2024 at 04:22, Michael Paquier wrote: > > > > On Wed, Jan 17, 2024 at 03:20:39PM +0300, Nazir Bilal Yavuz wrote: > > > I agree with your points. While the other I/O related work is > > > happening we can

Re: Show WAL write and fsync stats in pg_stat_io

2024-02-18 Thread Nazir Bilal Yavuz
Hi, On Thu, 18 Jan 2024 at 04:22, Michael Paquier wrote: > > On Wed, Jan 17, 2024 at 03:20:39PM +0300, Nazir Bilal Yavuz wrote: > > I agree with your points. While the other I/O related work is > > happening we can discuss what we should do in the variable op_byte > > cases. Also, this is

Re: Show WAL write and fsync stats in pg_stat_io

2024-01-17 Thread Michael Paquier
On Wed, Jan 17, 2024 at 03:20:39PM +0300, Nazir Bilal Yavuz wrote: > I agree with your points. While the other I/O related work is > happening we can discuss what we should do in the variable op_byte > cases. Also, this is happening only for WAL right now but if we try to > extend pg_stat_io in

Re: Show WAL write and fsync stats in pg_stat_io

2024-01-17 Thread Nazir Bilal Yavuz
Hi, On Mon, 15 Jan 2024 at 09:27, Michael Paquier wrote: > > On Fri, Jan 12, 2024 at 04:23:26PM +0300, Nazir Bilal Yavuz wrote: > > On Thu, 11 Jan 2024 at 17:28, Melanie Plageman > > wrote: > >> Even if we made a separate view for WAL I/O stats, we would still have > >> this issue of variable

Re: Show WAL write and fsync stats in pg_stat_io

2024-01-14 Thread Michael Paquier
On Fri, Jan 12, 2024 at 04:23:26PM +0300, Nazir Bilal Yavuz wrote: > On Thu, 11 Jan 2024 at 17:28, Melanie Plageman > wrote: >> Even if we made a separate view for WAL I/O stats, we would still have >> this issue of variable sized I/O vs block sized I/O and would probably >> end up solving it

Re: Show WAL write and fsync stats in pg_stat_io

2024-01-12 Thread Nazir Bilal Yavuz
Hi, On Thu, 11 Jan 2024 at 17:28, Melanie Plageman wrote: > > On Thu, Jan 11, 2024 at 6:19 AM Nazir Bilal Yavuz wrote: > > > > On Thu, 11 Jan 2024 at 08:01, Michael Paquier wrote: > > > > > > On Wed, Jan 10, 2024 at 07:24:50PM -0500, Melanie Plageman wrote: > > > > On Wed, Jan 3, 2024 at 8:11 

Re: Show WAL write and fsync stats in pg_stat_io

2024-01-11 Thread Melanie Plageman
On Thu, Jan 11, 2024 at 6:19 AM Nazir Bilal Yavuz wrote: > > On Thu, 11 Jan 2024 at 08:01, Michael Paquier wrote: > > > > On Wed, Jan 10, 2024 at 07:24:50PM -0500, Melanie Plageman wrote: > > > On Wed, Jan 3, 2024 at 8:11 AM Nazir Bilal Yavuz > > > wrote: > > >> On Sun, 31 Dec 2023 at 03:58,

Re: Show WAL write and fsync stats in pg_stat_io

2024-01-11 Thread Nazir Bilal Yavuz
Hi, On Thu, 11 Jan 2024 at 08:01, Michael Paquier wrote: > > On Wed, Jan 10, 2024 at 07:24:50PM -0500, Melanie Plageman wrote: > > I have code review feedback as well, but I've saved that for my next email. > > Ah, cool. > > > On Wed, Jan 3, 2024 at 8:11 AM Nazir Bilal Yavuz wrote: > >> On Sun,

Re: Show WAL write and fsync stats in pg_stat_io

2024-01-10 Thread Michael Paquier
On Wed, Jan 10, 2024 at 07:24:50PM -0500, Melanie Plageman wrote: > I have code review feedback as well, but I've saved that for my next email. Ah, cool. > On Wed, Jan 3, 2024 at 8:11 AM Nazir Bilal Yavuz wrote: >> On Sun, 31 Dec 2023 at 03:58, Michael Paquier wrote: >> Oh, I understand it

Re: Show WAL write and fsync stats in pg_stat_io

2024-01-10 Thread Melanie Plageman
I have code review feedback as well, but I've saved that for my next email. On Wed, Jan 3, 2024 at 8:11 AM Nazir Bilal Yavuz wrote: > > On Sun, 31 Dec 2023 at 03:58, Michael Paquier wrote: > > > > On Tue, Dec 26, 2023 at 03:35:52PM +0300, Nazir Bilal Yavuz wrote: > > > On Tue, 26 Dec 2023 at

Re: Show WAL write and fsync stats in pg_stat_io

2024-01-10 Thread Nazir Bilal Yavuz
Hi, On Wed, 10 Jan 2024 at 08:25, Michael Paquier wrote: > > On Wed, Jan 03, 2024 at 04:10:58PM +0300, Nazir Bilal Yavuz wrote: > > > > I thought removing op_bytes completely ( as you said "This patch > > extends it with two more operation sizes, and there are even cases > > where it may be a

Re: Show WAL write and fsync stats in pg_stat_io

2024-01-09 Thread Michael Paquier
On Wed, Jan 03, 2024 at 04:10:58PM +0300, Nazir Bilal Yavuz wrote: > On Sun, 31 Dec 2023 at 03:58, Michael Paquier wrote: >> Apologies if my previous wording sounded confusing. The idea I had in >> mind was to keep op_bytes in pg_stat_io, and extend it so as a value >> of NULL (or 0, or -1) is a

Re: Show WAL write and fsync stats in pg_stat_io

2024-01-03 Thread Nazir Bilal Yavuz
Hi, On Sun, 31 Dec 2023 at 03:58, Michael Paquier wrote: > > On Tue, Dec 26, 2023 at 03:35:52PM +0300, Nazir Bilal Yavuz wrote: > > On Tue, 26 Dec 2023 at 13:10, Michael Paquier wrote: > >> I am not sure while the whole point of the exercise is to have all the > >> I/O related data in a single

Re: Show WAL write and fsync stats in pg_stat_io

2023-12-30 Thread Michael Paquier
On Tue, Dec 26, 2023 at 03:35:52PM +0300, Nazir Bilal Yavuz wrote: > On Tue, 26 Dec 2023 at 13:10, Michael Paquier wrote: >> I am not sure while the whole point of the exercise is to have all the >> I/O related data in a single view. Something that I've also found a >> bit disturbing yesterday

Re: Show WAL write and fsync stats in pg_stat_io

2023-12-26 Thread Nazir Bilal Yavuz
Hi, On Tue, 26 Dec 2023 at 13:10, Michael Paquier wrote: > > On Tue, Dec 26, 2023 at 11:27:16AM +0300, Nazir Bilal Yavuz wrote: > > Maybe it is better to create a pg_stat_io_wal view like you said > > before. We could remove unused columns and add op_bytes for each > > writes and reads. Also, we

Re: Show WAL write and fsync stats in pg_stat_io

2023-12-26 Thread Michael Paquier
On Tue, Dec 26, 2023 at 11:27:16AM +0300, Nazir Bilal Yavuz wrote: > Maybe it is better to create a pg_stat_io_wal view like you said > before. We could remove unused columns and add op_bytes for each > writes and reads. Also, we can track both the number of bytes and the > number of the

Re: Show WAL write and fsync stats in pg_stat_io

2023-12-26 Thread Nazir Bilal Yavuz
Hi, On Tue, 26 Dec 2023 at 03:06, Michael Paquier wrote: > > On Mon, Dec 25, 2023 at 04:09:34PM +0300, Nazir Bilal Yavuz wrote: > > On Wed, 9 Aug 2023 at 21:52, Melanie Plageman > > wrote: > >> If there is any combination of BackendType and IOContext which will > >> always read XLOG_BLCKSZ

Re: Show WAL write and fsync stats in pg_stat_io

2023-12-25 Thread Michael Paquier
On Mon, Dec 25, 2023 at 04:09:34PM +0300, Nazir Bilal Yavuz wrote: > On Wed, 9 Aug 2023 at 21:52, Melanie Plageman > wrote: >> If there is any combination of BackendType and IOContext which will >> always read XLOG_BLCKSZ bytes, we could use XLOG_BLCKSZ for that row's >> op_bytes. For other

Re: Show WAL write and fsync stats in pg_stat_io

2023-12-25 Thread Nazir Bilal Yavuz
Hi, Thanks for the review and feedback on your previous reply! On Mon, 25 Dec 2023 at 09:40, Michael Paquier wrote: > > On Mon, Dec 25, 2023 at 03:20:58PM +0900, Michael Paquier wrote: > > pgstat_tracks_io_bktype() does not look correct to me. Why is the WAL > > receiver considered as

Re: Show WAL write and fsync stats in pg_stat_io

2023-12-24 Thread Michael Paquier
On Mon, Dec 25, 2023 at 03:20:58PM +0900, Michael Paquier wrote: > pgstat_tracks_io_bktype() does not look correct to me. Why is the WAL > receiver considered as something correct in the list of backend types, > while the intention is to *not* add it to pg_stat_io? I have tried to > switche to

Re: Show WAL write and fsync stats in pg_stat_io

2023-12-24 Thread Michael Paquier
On Sat, Dec 16, 2023 at 08:20:57PM +0100, Michael Paquier wrote: > One thing that 0001 missed is an update of the header where the > function is declared. I've edited a few things, and applied it to > start on this stuff. The rest will have to wait a bit more.. I have been reviewing the whole,

Re: Show WAL write and fsync stats in pg_stat_io

2023-12-16 Thread Michael Paquier
On Tue, Dec 12, 2023 at 02:29:03PM +0300, Nazir Bilal Yavuz wrote: > On Tue, 5 Dec 2023 at 09:16, Michael Paquier wrote: >> This interface from pgstat_prepare_io_time() is not really good, >> because we could finish by setting io_start in the existing code paths >> calling this routine even if

Re: Show WAL write and fsync stats in pg_stat_io

2023-12-12 Thread Nazir Bilal Yavuz
Hi, Thanks for the feedback! The new version of the patch is attached. On Tue, 5 Dec 2023 at 09:16, Michael Paquier wrote: > > - if (io_op == IOOP_WRITE || io_op == IOOP_EXTEND) > + if (io_op == IOOP_EXTEND || io_op == IOOP_WRITE) > > Unrelated diff. Done. > > + if (io_object ==

Re: Show WAL write and fsync stats in pg_stat_io

2023-12-04 Thread Michael Paquier
On Fri, Dec 01, 2023 at 12:02:05PM +0300, Nazir Bilal Yavuz wrote: > Thanks for all the feedback. I am sharing the new version of the patchset. > > - I didn't move 'PendingWalStats.wal_sync' out from the > 'pgstat_count_io_op_n' function because they count the same thing > (block vs system calls)

Re: Show WAL write and fsync stats in pg_stat_io

2023-12-01 Thread Nazir Bilal Yavuz
Hi, Thanks for all the feedback. I am sharing the new version of the patchset. Current status of the patchset is: - IOOBJECT_WAL / IOCONTEXT_NORMAL / read, write, fsync stats and their tests are added. - IOOBJECT_WAL / IOCONTEXT_INIT stats and their tests are added. - Documentation is updated. -

Re: Show WAL write and fsync stats in pg_stat_io

2023-12-01 Thread Nazir Bilal Yavuz
Hi, On Wed, 8 Nov 2023 at 10:34, Bharath Rupireddy wrote: > > Is there any plan to account for WAL read stats in the WALRead() > function which will cover walsenders i.e. WAL read by logical and > streaming replication, WAL read by pg_walinspect and so on? I see the > patch already covers WAL

Re: Show WAL write and fsync stats in pg_stat_io

2023-11-20 Thread Michael Paquier
On Mon, Nov 20, 2023 at 05:43:17PM +0300, Nazir Bilal Yavuz wrote: > Yes, the timings for the writes and the syncs should work. Another > question I have in mind is the pg_stat_reset_shared() function. When > we call it with 'io' it will reset pg_stat_wal's timings and when we > call it with 'wal'

Re: Show WAL write and fsync stats in pg_stat_io

2023-11-20 Thread Nazir Bilal Yavuz
Hi, Thanks for the feedback. On Mon, 20 Nov 2023 at 10:47, Michael Paquier wrote: > > On Thu, Nov 09, 2023 at 02:39:26PM +0300, Nazir Bilal Yavuz wrote: > > There are some differences between pg_stat_wal and pg_stat_io while > > collecting WAL stats. For example in the XLogWrite() function in

Re: Show WAL write and fsync stats in pg_stat_io

2023-11-19 Thread Michael Paquier
On Thu, Nov 09, 2023 at 02:39:26PM +0300, Nazir Bilal Yavuz wrote: > There are some differences between pg_stat_wal and pg_stat_io while > collecting WAL stats. For example in the XLogWrite() function in the > xlog.c file, pg_stat_wal counts wal_writes as write system calls. This > is not

Re: Show WAL write and fsync stats in pg_stat_io

2023-11-09 Thread Nazir Bilal Yavuz
Hi, On Wed, 8 Nov 2023 at 04:19, Andres Freund wrote: > > Hi, > > On 2023-11-08 09:52:16 +0900, Michael Paquier wrote: > > By the way, if the write/sync quantities and times begin to be tracked > > by pg_stat_io, I'd see a pretty good argument in removing the > > equivalent columns in

Re: Show WAL write and fsync stats in pg_stat_io

2023-11-09 Thread Nazir Bilal Yavuz
Hi, Thanks for all the feedback! On Wed, 8 Nov 2023 at 08:59, Michael Paquier wrote: > > By the way, note that the patch is failing to apply, and that I've > switched it as waiting on author on 10/26. Here is an updated patchset in attachment. Rebased on the latest HEAD and changed

Re: Show WAL write and fsync stats in pg_stat_io

2023-11-07 Thread Bharath Rupireddy
On Wed, Sep 20, 2023 at 1:28 PM Nazir Bilal Yavuz wrote: > > Hi, > > Thanks for the review! > > Current status of the patch is: > - IOOBJECT_WAL / IOCONTEXT_NORMAL read, write and fsync stats are added. > - IOOBJECT_WAL / IOCONTEXT_NORMAL write and fsync tests are added. > - IOOBJECT_WAL /

Re: Show WAL write and fsync stats in pg_stat_io

2023-11-07 Thread Michael Paquier
On Wed, Nov 08, 2023 at 10:27:44AM +0900, Michael Paquier wrote: > Yep, I'd be OK with that as well to maintain compatibility. By the way, note that the patch is failing to apply, and that I've switched it as waiting on author on 10/26. -- Michael signature.asc Description: PGP signature

Re: Show WAL write and fsync stats in pg_stat_io

2023-11-07 Thread Michael Paquier
On Tue, Nov 07, 2023 at 05:19:28PM -0800, Andres Freund wrote: > Another approach would be to fetch the relevant columns from pg_stat_io in the > pg_stat_wal view. That'd avoid double accounting and breaking existing > monitoring. Yep, I'd be OK with that as well to maintain compatibility. --

Re: Show WAL write and fsync stats in pg_stat_io

2023-11-07 Thread Andres Freund
Hi, On 2023-11-08 09:52:16 +0900, Michael Paquier wrote: > By the way, if the write/sync quantities and times begin to be tracked > by pg_stat_io, I'd see a pretty good argument in removing the > equivalent columns in pg_stat_wal. It looks like this would reduce > the confusion related to the

Re: Show WAL write and fsync stats in pg_stat_io

2023-11-07 Thread Michael Paquier
On Tue, Nov 07, 2023 at 03:30:48PM -0800, Andres Freund wrote: > I strongly disagree. A significant part of the design of pg_stat_io was to > make it possible to collect multiple sources of IO in a single view, so that > sysadmins don't have to look in dozens of places to figure out what is

Re: Show WAL write and fsync stats in pg_stat_io

2023-11-07 Thread Andres Freund
Hi, On 2023-10-26 15:28:32 +0900, Michael Paquier wrote: > On top of that pg_stat_io is now for block-based I/O operations, so > that does not fit entirely in the picture, though I guess that Melanie > has thought more on the matter than me. That may be also a matter of > taste. I strongly

Re: Show WAL write and fsync stats in pg_stat_io

2023-11-06 Thread Michael Paquier
On Mon, Nov 06, 2023 at 03:35:01PM +0300, Nazir Bilal Yavuz wrote: > Results are: > > ╔═╦═══╦╗ > ║ ║ track_wal_io_timing ║║ > ╠═╬═══╦═══╬╣ > ║ clock ║ on ║ off ║

Re: Show WAL write and fsync stats in pg_stat_io

2023-11-06 Thread Nazir Bilal Yavuz
Hi, On Tue, 31 Oct 2023 at 16:57, Nazir Bilal Yavuz wrote: > On Thu, 26 Oct 2023 at 09:28, Michael Paquier wrote: > > > > And perhaps just putting that everything that calls > > pgstat_count_io_op_time() under track_io_timing is just natural? > > What's the performance regression you would

Re: Show WAL write and fsync stats in pg_stat_io

2023-10-31 Thread Nazir Bilal Yavuz
Hi, Thank you for the feedback! On Thu, 26 Oct 2023 at 09:28, Michael Paquier wrote: > > On Wed, Sep 20, 2023 at 10:57:48AM +0300, Nazir Bilal Yavuz wrote: > > Any kind of feedback would be appreciated. > > This was registered in the CF, so I have given it a look. Note that > 0001 has a

Re: Show WAL write and fsync stats in pg_stat_io

2023-10-26 Thread Michael Paquier
On Wed, Sep 20, 2023 at 10:57:48AM +0300, Nazir Bilal Yavuz wrote: > Any kind of feedback would be appreciated. This was registered in the CF, so I have given it a look. Note that 0001 has a conflict with pgstat_count_io_op_time(), so it cannot be applied. +pgstat_should_track_io_time(IOObject

Re: Show WAL write and fsync stats in pg_stat_io

2023-09-20 Thread Nazir Bilal Yavuz
Hi, Thanks for the review! Current status of the patch is: - IOOBJECT_WAL / IOCONTEXT_NORMAL read, write and fsync stats are added. - IOOBJECT_WAL / IOCONTEXT_NORMAL write and fsync tests are added. - IOOBJECT_WAL / IOCONTEXT_INIT stats are added. - pg_stat_io shows different op_bytes for the

Re: Show WAL write and fsync stats in pg_stat_io

2023-08-09 Thread Melanie Plageman
On Thu, Aug 03, 2023 at 04:38:41PM +0300, Nazir Bilal Yavuz wrote: > Current status of the patch is: > - 'WAL read' stats in xlogrecovery.c are added to pg_stat_io. > - IOCONTEXT_INIT is added to count 'WAL init'. 'WAL init' stats are > added to pg_stat_io. > - pg_stat_io shows different op_bytes

Re: Show WAL write and fsync stats in pg_stat_io

2023-08-03 Thread Nazir Bilal Yavuz
Hi, Thanks for the review! Current status of the patch is: - 'WAL read' stats in xlogrecovery.c are added to pg_stat_io. - IOCONTEXT_INIT is added to count 'WAL init'. 'WAL init' stats are added to pg_stat_io. - pg_stat_io shows different op_bytes for the IOOBJECT_WAL operations. - Working on

Re: Show WAL write and fsync stats in pg_stat_io

2023-07-21 Thread Melanie Plageman
On Wed, Jun 28, 2023 at 6:09 AM Nazir Bilal Yavuz wrote: > This is a WIP patch to add WAL write and fsync stats to pg_stat_io > view. Thanks for working on this! I have some feedback on the content of the patch as well as some items that I feel are missing. I think it would be good to count WAL

Show WAL write and fsync stats in pg_stat_io

2023-06-28 Thread Nazir Bilal Yavuz
Hi, This is a WIP patch to add WAL write and fsync stats to pg_stat_io view. There is a track_io_timing variable to control pg_stat_io timings and a track_wal_io_timing variable to control WAL timings. I couldn't decide on which logic to enable WAL timings on pg_stat_io. For now, both pg_stat_io