Re: Track IO times in pg_stat_io

2024-09-02 Thread Michael Paquier
On Mon, Sep 02, 2024 at 03:00:32PM +, Bertrand Drouvot wrote: > On Fri, Aug 23, 2024 at 07:32:16AM +, Bertrand Drouvot wrote: >> FWIW, I think that would be great and plan to have a look at this (unless >> someone >> beats me to it). > > FWIW, here is the patch proposal for per backend I/

Re: Track IO times in pg_stat_io

2024-09-02 Thread Bertrand Drouvot
Hi, On Fri, Aug 23, 2024 at 07:32:16AM +, Bertrand Drouvot wrote: > Hi, > > On Wed, Mar 08, 2023 at 04:34:38PM -0800, Andres Freund wrote: > > On 2023-03-08 12:55:34 +0100, Drouvot, Bertrand wrote: > > > - pg_stat_io is "global" across all sessions. So, even if one session is > > > doing som

Re: Track IO times in pg_stat_io

2024-08-23 Thread Bertrand Drouvot
Hi, On Wed, Mar 08, 2023 at 04:34:38PM -0800, Andres Freund wrote: > On 2023-03-08 12:55:34 +0100, Drouvot, Bertrand wrote: > > - pg_stat_io is "global" across all sessions. So, even if one session is > > doing some "testing" and needs to turn track_io_timing on, then it > > is even not sure it's

Re: Track IO times in pg_stat_io

2023-04-07 Thread Andres Freund
Hi, On 2023-04-07 12:17:38 -0400, Melanie Plageman wrote: > Attached v9 addresses review feedback as well as resolving merge > conflicts with recent relation extension patchset. I've edited it a bit more: - removed pgstat_tracks_io_time() and replaced it by returning the new IO_COL_INVALID = -

Re: Track IO times in pg_stat_io

2023-04-07 Thread Melanie Plageman
//postgr.es/m/20230321023451.7rzy4kjj2iktrg2r%40awork3.anarazel.de --- src/backend/storage/buffer/localbuf.c | 16 1 file changed, 16 insertions(+) diff --git a/src/backend/storage/buffer/localbuf.c b/src/backend/storage/buffer/localbuf.c index 3846d3eaca..3639296bc1 100644 --- a/s

Re: Track IO times in pg_stat_io

2023-04-04 Thread Andres Freund
} > + > + pgBufferUsage.local_blks_written++; > + > /* Pop the error context stack */ > error_context_stack = errcallback.previous; > } > -- > 2.37.2 > > From 2bdad725133395ded19

Re: Track IO times in pg_stat_io

2023-03-31 Thread Melanie Plageman
ActiveTime += (n)) #define pgstat_count_conn_txn_idle_time(n) \ -- 2.37.2 From 2bdad725133395ded199ecc726096e052d6e654b Mon Sep 17 00:00:00 2001 From: Melanie Plageman Date: Fri, 31 Mar 2023 15:32:36 -0400 Subject: [PATCH v8 3/4] Track IO times in pg_stat_io Add IO timing for reads, writes, extend

Re: Track IO times in pg_stat_io

2023-03-21 Thread Melanie Plageman
+526,6 @@ extern void pgstat_report_checksum_failures_in_db(Oid dboid, int failurecount); extern void pgstat_report_checksum_failure(void); extern void pgstat_report_connect(Oid dboid); -#define pgstat_count_buffer_read_time(n) \ - (pgStatBlockReadTime += (n)) -#define pgstat_count_buffer_write_time(n) \ -

Re: Track IO times in pg_stat_io

2023-03-20 Thread Andres Freund
─┬─┬─┐ │ reuses │ evictions │ writes │ write_time │ extends │ extend_time │ ├─┼───┼─┼┼─┼─┤ │ 1318539 │ 0 │ 1318539 │ 5013 │ 1523339 │7873 │ └─┴───┴─────┴────┴─┴─┘ (1 row) Greetings, Andres >From 5d4

Re: Track IO times in pg_stat_io

2023-03-16 Thread Melanie Plageman
gStat_BktypeIO. I am not quite sure if this is okay. I store in microsec and then in pg_stat_io, I multiply to get milliseconds for display. I considered refactoring pgstat_io_end() to use INSTR_TIME_ACCUM_DIFF() like [1], but, in the end I actually think I would end up with more operations becaus

Re: Track IO times in pg_stat_io

2023-03-14 Thread Andres Freund
Hi, On 2023-03-09 11:50:38 -0500, Melanie Plageman wrote: > On Tue, Mar 7, 2023 at 1:39 PM Andres Freund wrote: > > On 2023-03-06 11:30:13 -0500, Melanie Plageman wrote: > > > > As pgstat_bktype_io_stats_valid() is called only in Assert(), I think > > > > that would be a good idea > > > > to als

Re: Track IO times in pg_stat_io

2023-03-09 Thread Melanie Plageman
IOOP_NUM_TYPES]; > > + PgStat_Counter > > counts[IOOBJECT_NUM_TYPES][IOCONTEXT_NUM_TYPES][IOOP_NUM_TYPES]; > > + instr_time > > times[IOOBJECT_NUM_TYPES][IOCONTEXT_NUM_TYPES][IOOP_NUM_TYPES]; > > } PgStat_BktypeIO; > > Ah, you're going to hate

Re: Track IO times in pg_stat_io

2023-03-09 Thread Imseih (AWS), Sami
> >>> Now I've a second thought: what do you think about resetting the related > >>> number > >>> of operations and *_time fields when enabling/disabling track_io_timing? > >>> (And mention it in the doc). > >>> > >>> That way it'd prevent bad interpretation (at least as far the time per > >>> o

Re: Track IO times in pg_stat_io

2023-03-09 Thread Drouvot, Bertrand
Hi, On 3/9/23 1:34 AM, Andres Freund wrote: Hi, On 2023-03-08 12:55:34 +0100, Drouvot, Bertrand wrote: On 3/7/23 7:47 PM, Andres Freund wrote: On 2023-03-07 13:43:28 -0500, Melanie Plageman wrote: No, I don't think we can do that. It can be enabled on a per-session basis. Oh right. So it's

Re: Track IO times in pg_stat_io

2023-03-08 Thread Andres Freund
Hi, On 2023-03-08 12:55:34 +0100, Drouvot, Bertrand wrote: > On 3/7/23 7:47 PM, Andres Freund wrote: > > On 2023-03-07 13:43:28 -0500, Melanie Plageman wrote: > > > > Now I've a second thought: what do you think about resetting the > > > > related number > > > > of operations and *_time fields wh

Re: Track IO times in pg_stat_io

2023-03-08 Thread Drouvot, Bertrand
Hi, On 3/7/23 7:47 PM, Andres Freund wrote: On 2023-03-07 13:43:28 -0500, Melanie Plageman wrote: Now I've a second thought: what do you think about resetting the related number of operations and *_time fields when enabling/disabling track_io_timing? (And mention it in the doc). That way it'd

Re: Track IO times in pg_stat_io

2023-03-07 Thread Andres Freund
On 2023-03-07 13:43:28 -0500, Melanie Plageman wrote: > > Now I've a second thought: what do you think about resetting the related > > number > > of operations and *_time fields when enabling/disabling track_io_timing? > > (And mention it in the doc). > > > > That way it'd prevent bad interpretat

Re: Track IO times in pg_stat_io

2023-03-07 Thread Melanie Plageman
Thanks for taking another look! On Tue, Mar 7, 2023 at 10:52 AM Drouvot, Bertrand wrote: > On 3/6/23 5:30 PM, Melanie Plageman wrote: > > Thanks for the review! > > > > On Tue, Feb 28, 2023 at 4:49 AM Drouvot, Bertrand > > wrote: > >> On 2/26/23 5:03 PM, Melanie Plageman wrote: > >>> The timings

Re: Track IO times in pg_stat_io

2023-03-07 Thread Andres Freund
Hi, On 2023-03-06 11:30:13 -0500, Melanie Plageman wrote: > > As pgstat_bktype_io_stats_valid() is called only in Assert(), I think that > > would be a good idea > > to also check that if counts are not Zero then times are not Zero. > > Yes, I think adding some validation around the relationship

Re: Track IO times in pg_stat_io

2023-03-07 Thread Drouvot, Bertrand
Hi, On 3/6/23 5:30 PM, Melanie Plageman wrote: Thanks for the review! On Tue, Feb 28, 2023 at 4:49 AM Drouvot, Bertrand wrote: On 2/26/23 5:03 PM, Melanie Plageman wrote: The timings will only be non-zero when track_io_timing is on That could lead to incorrect interpretation if one wants t

Re: Track IO times in pg_stat_io

2023-03-06 Thread Melanie Plageman
at if IO times are not zero, IO counts are not zero. I've done this in the attached v3. - Melanie From 52d997001108a52c833b339f9b8dcb3d34ed3270 Mon Sep 17 00:00:00 2001 From: Melanie Plageman Date: Mon, 6 Mar 2023 10:41:51 -0500 Subject: [PATCH v3] Track IO times in pg_stat_io Add IO timin

Re: Track IO times in pg_stat_io

2023-02-28 Thread Drouvot, Bertrand
Hi, On 2/26/23 5:03 PM, Melanie Plageman wrote: Hi, As suggested in [1], the attached patch adds IO times to pg_stat_io; Thanks for the patch! I started to have a look at it and figured out that a tiny rebase was needed (due to 728560db7d and b9f0e54bc9), so please find the rebase (aka V2)

Track IO times in pg_stat_io

2023-02-26 Thread Melanie Plageman
m: Melanie Plageman Date: Sat, 25 Feb 2023 18:09:10 -0500 Subject: [PATCH v1] Track IO times in pg_stat_io Add IO timing for reads, writes, extends, and fsyncs to pg_stat_io. --- doc/src/sgml/monitoring.sgml | 48 +++ src/backend/catalog/system_views.sql | 4 ++ src/backe