Re: SLRU statistics

2020-05-14 Thread Tom Lane
Robert Haas writes: > I'm confused by why SLRU statistics are reported by messages sent to > the stats collector rather than by just directly updating shared > memory. It would be better to consider that as an aspect of the WIP stats collector redesign, rather than inventing a bespoke mechanism

Re: SLRU statistics

2020-05-14 Thread Robert Haas
On Thu, May 14, 2020 at 2:27 AM Fujii Masao wrote: > Therefore what we can do right now seems to make checkpointer report the SLRU > stats while it's running. Other issues need more time to investigate... > Thought? I'm confused by why SLRU statistics are reported by messages sent to the stats

Re: SLRU statistics

2020-05-14 Thread Fujii Masao
On 2020/05/07 13:47, Fujii Masao wrote: On 2020/05/03 1:59, Tomas Vondra wrote: On Sat, May 02, 2020 at 12:55:00PM +0200, Tomas Vondra wrote: On Sat, May 02, 2020 at 03:56:07PM +0900, Fujii Masao wrote: ... Another thing I found is; pgstat_send_slru() should be called also by other

Re: SLRU statistics

2020-05-13 Thread Tom Lane
Fujii Masao writes: > On 2020/05/14 2:44, Tom Lane wrote: >> I got through check-world with the assertion shown that we are not >> counting any SLRU operations in the postmaster. Don't know if we >> want to commit that or not --- any thoughts? > +1 to add this assertion because basically it's

Re: SLRU statistics

2020-05-13 Thread Fujii Masao
On 2020/05/14 2:44, Tom Lane wrote: I wrote: (IIRC only the Async module is doing that.) Hm, maybe we can fix that. Yeah, it's quite easy to make async.c postpone its first write to the async SLRU. This seems like a win all around, because many installations don't use NOTIFY and so

Re: SLRU statistics

2020-05-13 Thread Ranier Vilela
Em qua., 13 de mai. de 2020 às 11:46, Fujii Masao < masao.fu...@oss.nttdata.com> escreveu: > > > On 2020/05/13 23:26, Tom Lane wrote: > > Fujii Masao writes: > >> On 2020/05/13 17:21, Tomas Vondra wrote: > >>> On Wed, May 13, 2020 at 04:10:30PM +0900, Fujii Masao wrote: > Also I found

Re: SLRU statistics

2020-05-13 Thread Tom Lane
I wrote: >>> (IIRC only the Async module is doing that.) > Hm, maybe we can fix that. Yeah, it's quite easy to make async.c postpone its first write to the async SLRU. This seems like a win all around, because many installations don't use NOTIFY and so will never need to do that work at all.

Re: SLRU statistics

2020-05-13 Thread Tom Lane
Fujii Masao writes: > But since the counter that postmaster incremented is propagated to > child processes via fork, it should be zeroed at postmaster or the > beginning of child process? Otherwise that counter always starts > with non-zero in child process. Yes, if the postmaster is

Re: SLRU statistics

2020-05-13 Thread Fujii Masao
On 2020/05/14 1:14, Alvaro Herrera wrote: On 2020-May-14, Fujii Masao wrote: So I tried the similar test again and found that postmaster seems to be able to increment the counters unless I'm missing something. For example, frame #2: 0x00010d93845f

Re: SLRU statistics

2020-05-13 Thread Alvaro Herrera
On 2020-May-14, Fujii Masao wrote: > So I tried the similar test again and found that postmaster seems to be > able to increment the counters unless I'm missing something. > For example, > > frame #2: 0x00010d93845f > postgres`pgstat_count_slru_page_zeroed(ctl=0x00010de27320) at >

Re: SLRU statistics

2020-05-13 Thread Fujii Masao
On 2020/05/14 0:38, Tom Lane wrote: Tomas Vondra writes: I think it counts as a variable with "static storage duration" per 6.7.8 (para 10), see [1]. I wasn't aware of this either, but it probably means the memset is unnecessary. Also, it seems a bit strange/confusing to handle this

Re: SLRU statistics

2020-05-13 Thread Tom Lane
Tomas Vondra writes: > I think it counts as a variable with "static storage duration" per 6.7.8 > (para 10), see [1]. I wasn't aware of this either, but it probably means > the memset is unnecessary. > Also, it seems a bit strange/confusing to handle this differently from > BgWriterStats. And

Re: SLRU statistics

2020-05-13 Thread Tomas Vondra
On Wed, May 13, 2020 at 11:46:30PM +0900, Fujii Masao wrote: On 2020/05/13 23:26, Tom Lane wrote: Fujii Masao writes: On 2020/05/13 17:21, Tomas Vondra wrote: On Wed, May 13, 2020 at 04:10:30PM +0900, Fujii Masao wrote: Also I found another minor issue; SLRUStats has not been initialized

Re: SLRU statistics

2020-05-13 Thread Tomas Vondra
On Wed, May 13, 2020 at 11:01:47AM -0400, Tom Lane wrote: Tomas Vondra writes: On Wed, May 13, 2020 at 10:26:39AM -0400, Tom Lane wrote: Why is that necessary? A static variable is defined by C to start off as zeroes. But is it a static variable? It's not declared as 'static' but maybe we

Re: SLRU statistics

2020-05-13 Thread Tom Lane
Tomas Vondra writes: > On Wed, May 13, 2020 at 10:26:39AM -0400, Tom Lane wrote: >> Why is that necessary? A static variable is defined by C to start off >> as zeroes. > But is it a static variable? It's not declared as 'static' but maybe we > can assume it inits to zeroes anyway? I see we do

Re: SLRU statistics

2020-05-13 Thread Tomas Vondra
On Wed, May 13, 2020 at 10:26:39AM -0400, Tom Lane wrote: Fujii Masao writes: On 2020/05/13 17:21, Tomas Vondra wrote: On Wed, May 13, 2020 at 04:10:30PM +0900, Fujii Masao wrote: Also I found another minor issue; SLRUStats has not been initialized to 0 and which could update the counters

Re: SLRU statistics

2020-05-13 Thread Fujii Masao
On 2020/05/13 23:26, Tom Lane wrote: Fujii Masao writes: On 2020/05/13 17:21, Tomas Vondra wrote: On Wed, May 13, 2020 at 04:10:30PM +0900, Fujii Masao wrote: Also I found another minor issue; SLRUStats has not been initialized to 0 and which could update the counters unexpectedly.

Re: SLRU statistics

2020-05-13 Thread Tom Lane
Fujii Masao writes: > On 2020/05/13 17:21, Tomas Vondra wrote: >> On Wed, May 13, 2020 at 04:10:30PM +0900, Fujii Masao wrote: >>> Also I found another minor issue; SLRUStats has not been initialized to 0 >>> and which could update the counters unexpectedly. Attached patch fixes >>> this issue.

Re: SLRU statistics

2020-05-13 Thread Fujii Masao
On 2020/05/13 17:21, Tomas Vondra wrote: On Wed, May 13, 2020 at 04:10:30PM +0900, Fujii Masao wrote: On 2020/05/07 13:47, Fujii Masao wrote: On 2020/05/03 1:59, Tomas Vondra wrote: On Sat, May 02, 2020 at 12:55:00PM +0200, Tomas Vondra wrote: On Sat, May 02, 2020 at 03:56:07PM +0900,

Re: SLRU statistics

2020-05-13 Thread Tomas Vondra
On Wed, May 13, 2020 at 04:10:30PM +0900, Fujii Masao wrote: On 2020/05/07 13:47, Fujii Masao wrote: On 2020/05/03 1:59, Tomas Vondra wrote: On Sat, May 02, 2020 at 12:55:00PM +0200, Tomas Vondra wrote: On Sat, May 02, 2020 at 03:56:07PM +0900, Fujii Masao wrote: ... Another thing I

Re: SLRU statistics

2020-05-13 Thread Fujii Masao
On 2020/05/07 13:47, Fujii Masao wrote: On 2020/05/03 1:59, Tomas Vondra wrote: On Sat, May 02, 2020 at 12:55:00PM +0200, Tomas Vondra wrote: On Sat, May 02, 2020 at 03:56:07PM +0900, Fujii Masao wrote: ... Another thing I found is; pgstat_send_slru() should be called also by other

Re: SLRU statistics

2020-05-06 Thread Fujii Masao
On 2020/05/03 1:59, Tomas Vondra wrote: On Sat, May 02, 2020 at 12:55:00PM +0200, Tomas Vondra wrote: On Sat, May 02, 2020 at 03:56:07PM +0900, Fujii Masao wrote: ... Another thing I found is; pgstat_send_slru() should be called also by other processes than backend? For example, since

Re: SLRU statistics

2020-05-02 Thread Tomas Vondra
On Sat, May 02, 2020 at 12:55:00PM +0200, Tomas Vondra wrote: On Sat, May 02, 2020 at 03:56:07PM +0900, Fujii Masao wrote: ... Another thing I found is; pgstat_send_slru() should be called also by other processes than backend? For example, since clog data is flushed basically by

Re: SLRU statistics

2020-05-02 Thread Tomas Vondra
On Sat, May 02, 2020 at 03:56:07PM +0900, Fujii Masao wrote: On 2020/05/02 9:08, Tomas Vondra wrote: On Fri, May 01, 2020 at 11:49:51AM +0900, Fujii Masao wrote: On 2020/05/01 3:19, Tomas Vondra wrote: On Fri, May 01, 2020 at 03:02:59AM +0900, Fujii Masao wrote: On 2020/04/02 9:41,

Re: SLRU statistics

2020-05-02 Thread Fujii Masao
On 2020/05/02 9:08, Tomas Vondra wrote: On Fri, May 01, 2020 at 11:49:51AM +0900, Fujii Masao wrote: On 2020/05/01 3:19, Tomas Vondra wrote: On Fri, May 01, 2020 at 03:02:59AM +0900, Fujii Masao wrote: On 2020/04/02 9:41, Tomas Vondra wrote: Hi, I've pushed this after some minor

Re: SLRU statistics

2020-05-01 Thread Tomas Vondra
On Fri, May 01, 2020 at 11:49:51AM +0900, Fujii Masao wrote: On 2020/05/01 3:19, Tomas Vondra wrote: On Fri, May 01, 2020 at 03:02:59AM +0900, Fujii Masao wrote: On 2020/04/02 9:41, Tomas Vondra wrote: Hi, I've pushed this after some minor cleanup and improvements. +static char

Re: SLRU statistics

2020-04-30 Thread Fujii Masao
On 2020/05/01 3:19, Tomas Vondra wrote: On Fri, May 01, 2020 at 03:02:59AM +0900, Fujii Masao wrote: On 2020/04/02 9:41, Tomas Vondra wrote: Hi, I've pushed this after some minor cleanup and improvements. +static char *slru_names[] = {"async", "clog", "commit_timestamp", +  

Re: SLRU statistics

2020-04-30 Thread Fujii Masao
On 2020/04/02 9:41, Tomas Vondra wrote: Hi, I've pushed this after some minor cleanup and improvements. +static char *slru_names[] = {"async", "clog", "commit_timestamp", + "multixact_offset", "multixact_member", +

Re: SLRU statistics

2020-04-07 Thread Tomas Vondra
On Tue, Apr 07, 2020 at 05:01:37PM +0530, Kuntal Ghosh wrote: Hello Tomas, On Thu, Apr 2, 2020 at 5:59 PM Tomas Vondra wrote: Thank you for the patch, pushed. In SimpleLruReadPage_ReadOnly, we first try to find the SLRU page in shared buffer under shared lock, then conditionally visit

Re: SLRU statistics

2020-04-07 Thread Kuntal Ghosh
Hello Tomas, On Thu, Apr 2, 2020 at 5:59 PM Tomas Vondra wrote: > Thank you for the patch, pushed. > In SimpleLruReadPage_ReadOnly, we first try to find the SLRU page in shared buffer under shared lock, then conditionally visit SimpleLruReadPage if reading is necessary. IMHO, we should update

Re: SLRU statistics

2020-04-02 Thread Tomas Vondra
On Thu, Apr 02, 2020 at 02:04:10AM +, Shinoda, Noriyoshi (PN Japan A Delivery) wrote: Hi, Thank you for developing great features. The attached patch is a small fix to the committed documentation for the data type name of blks_hit column. Thank you for the patch, pushed. regards --

RE: SLRU statistics

2020-04-01 Thread Shinoda, Noriyoshi (PN Japan A Delivery)
, 2020 9:42 AM To: Alvaro Herrera Cc: Masahiko Sawada ; tsunakawa.ta...@fujitsu.com; pgsql-hack...@postgresql.org Subject: Re: SLRU statistics Hi, I've pushed this after some minor cleanup and improvements. regards -- Tomas Vondra http://www.2ndQuadrant.com PostgreSQL

Re: SLRU statistics

2020-04-01 Thread Tomas Vondra
Hi, I've pushed this after some minor cleanup and improvements. regards -- Tomas Vondra http://www.2ndQuadrant.com PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

Re: SLRU statistics

2020-03-27 Thread Tomas Vondra
Hi, here is a bit improved version of the patch - I've been annoyed by how the resetting works (per-entry timestamp, but resetting all entries) so I've added a new function pg_stat_reset_slru() that allows resetting either all entries or just one entry (identified by name). So SELECT

Re: SLRU statistics

2020-03-26 Thread Tomas Vondra
Hi, Attached is v3 of the patch with one big change and various small ones. The main change is that it gets rid of the SlruType enum and the new field in SlruCtlData. Instead, the patch now uses the name passed to SimpleLruInit (which is then stored as LWLock tranche name). The counters are

Re: SLRU statistics

2020-02-29 Thread Tomas Vondra
On Sat, Feb 29, 2020 at 11:44:26AM -0300, Alvaro Herrera wrote: On 2020-Feb-29, Tomas Vondra wrote: Did we actually remove track-enabling GUCs? I think we still have - track_activities - track_counts - track_io_timing - track_functions But maybe I'm missing something? Hm I remembered

Re: SLRU statistics

2020-02-29 Thread Alvaro Herrera
On 2020-Feb-29, Tomas Vondra wrote: > Did we actually remove track-enabling GUCs? I think we still have > > - track_activities > - track_counts > - track_io_timing > - track_functions > > But maybe I'm missing something? Hm I remembered we removed the one for row-level stats

Re: SLRU statistics

2020-02-29 Thread Tomas Vondra
On Fri, Feb 28, 2020 at 08:19:18PM -0300, Alvaro Herrera wrote: On 2020-Jan-21, Tomas Vondra wrote: On Tue, Jan 21, 2020 at 05:09:33PM +0900, Masahiko Sawada wrote: > I've not tested the performance impact but perhaps we might want to > disable these counter by default and controlled by a

Re: SLRU statistics

2020-02-28 Thread Alvaro Herrera
On 2020-Jan-21, Tomas Vondra wrote: > On Tue, Jan 21, 2020 at 05:09:33PM +0900, Masahiko Sawada wrote: > > I've not tested the performance impact but perhaps we might want to > > disable these counter by default and controlled by a GUC. And similar > > to buffer statistics it might be better to

Re: SLRU statistics

2020-01-21 Thread Tomas Vondra
On Tue, Jan 21, 2020 at 06:24:29AM +, tsunakawa.ta...@fujitsu.com wrote: From: Tomas Vondra You're right the users can't really take advantage of this - my primary motivation was providing a feedback for devs, benchmarking etc. That might have been done with DEBUG messages or something,

Re: SLRU statistics

2020-01-21 Thread Tomas Vondra
On Tue, Jan 21, 2020 at 05:09:33PM +0900, Masahiko Sawada wrote: On Tue, 21 Jan 2020 at 01:38, Tomas Vondra wrote: On Mon, Jan 20, 2020 at 01:04:33AM +, tsunakawa.ta...@fujitsu.com wrote: >From: Tomas Vondra >> One of the stats I occasionally wanted to know are stats for the SLRU >>

Re: SLRU statistics

2020-01-21 Thread Masahiko Sawada
On Tue, 21 Jan 2020 at 01:38, Tomas Vondra wrote: > > On Mon, Jan 20, 2020 at 01:04:33AM +, tsunakawa.ta...@fujitsu.com wrote: > >From: Tomas Vondra > >> One of the stats I occasionally wanted to know are stats for the SLRU > >> stats (we have couple of those - clog, subtrans, ...). So here

RE: SLRU statistics

2020-01-20 Thread tsunakawa.ta...@fujitsu.com
From: Tomas Vondra > You're right the users can't really take advantage of this - my primary > motivation was providing a feedback for devs, benchmarking etc. That > might have been done with DEBUG messages or something, but this seems > more convenient. Understood. I'm in favor of adding

Re: SLRU statistics

2020-01-20 Thread Tomas Vondra
On Mon, Jan 20, 2020 at 03:01:36PM -0300, Alvaro Herrera wrote: On 2020-Jan-20, Tomas Vondra wrote: On Mon, Jan 20, 2020 at 01:04:33AM +, tsunakawa.ta...@fujitsu.com wrote: > From: Tomas Vondra > > One of the stats I occasionally wanted to know are stats for the SLRU > > stats (we have

Re: SLRU statistics

2020-01-20 Thread Alvaro Herrera
On 2020-Jan-20, Tomas Vondra wrote: > On Mon, Jan 20, 2020 at 01:04:33AM +, tsunakawa.ta...@fujitsu.com wrote: > > From: Tomas Vondra > > > One of the stats I occasionally wanted to know are stats for the SLRU > > > stats (we have couple of those - clog, subtrans, ...). So here is a WIP > >

Re: SLRU statistics

2020-01-20 Thread Tomas Vondra
On Mon, Jan 20, 2020 at 01:04:33AM +, tsunakawa.ta...@fujitsu.com wrote: From: Tomas Vondra One of the stats I occasionally wanted to know are stats for the SLRU stats (we have couple of those - clog, subtrans, ...). So here is a WIP version of a patch adding that. How can users take

RE: SLRU statistics

2020-01-19 Thread tsunakawa.ta...@fujitsu.com
From: Tomas Vondra > One of the stats I occasionally wanted to know are stats for the SLRU > stats (we have couple of those - clog, subtrans, ...). So here is a WIP > version of a patch adding that. How can users take advantage of this information? I think we also need the ability to set the