Re: WIP: new system catalog pg_wait_event

2023-10-23 Thread Michael Paquier
On Mon, Oct 23, 2023 at 01:17:42PM +0300, Pavel Luzanov wrote: > I propose to add a table alias for the wait_event column in the > WHERE clause for consistency. Okay by me that it looks like an improvement to understand where this attribute is from, so applied on HEAD. -- Michael signature.asc D

Re: WIP: new system catalog pg_wait_event

2023-10-23 Thread Pavel Luzanov
Please, consider this small fix for the query example in the docs[1]: SELECT a.pid, a.wait_event, w.description FROM pg_stat_activity a JOIN pg_wait_events w ON (a.wait_event_type = w.type AND a.wait_event = w.name) WHERE wait_event is NOT NULL and a.state =

Re: WIP: new system catalog pg_wait_event

2023-08-21 Thread Drouvot, Bertrand
Hi, On 8/20/23 10:07 AM, Michael Paquier wrote: On Sat, Aug 19, 2023 at 06:30:12PM +0200, Drouvot, Bertrand wrote: Thanks, fixed in v10. Okay. I have done an extra review of it, simplifying a few things in the function, the comments and the formatting, and applied the patch. Thanks! Regar

Re: WIP: new system catalog pg_wait_event

2023-08-20 Thread Michael Paquier
On Sat, Aug 19, 2023 at 06:30:12PM +0200, Drouvot, Bertrand wrote: > Thanks, fixed in v10. Okay. I have done an extra review of it, simplifying a few things in the function, the comments and the formatting, and applied the patch. Thanks! I have somewhat managed to miss the catalog version in the

Re: WIP: new system catalog pg_wait_event

2023-08-19 Thread Drouvot, Bertrand
Hi, On 8/19/23 12:00 PM, Michael Paquier wrote: On Sat, Aug 19, 2023 at 11:35:01AM +0200, Drouvot, Bertrand wrote: Hi, On 8/18/23 12:31 PM, Michael Paquier wrote: Thanks! Please find attached v9 fixing this typo. I was looking at v8, and this looks pretty good to me. Great! I have spott

Re: WIP: new system catalog pg_wait_event

2023-08-19 Thread Michael Paquier
On Sat, Aug 19, 2023 at 11:35:01AM +0200, Drouvot, Bertrand wrote: > Hi, > > On 8/18/23 12:31 PM, Michael Paquier wrote: > Thanks! Please find attached v9 fixing this typo. I was looking at v8, and this looks pretty good to me. I have spotted a few minor things. + proretset => 't', provolatile

Re: WIP: new system catalog pg_wait_event

2023-08-19 Thread Drouvot, Bertrand
Hi, On 8/18/23 12:31 PM, Michael Paquier wrote: On Fri, Aug 18, 2023 at 10:56:55AM +0200, Drouvot, Bertrand wrote: Okay, using the plural form in v8 attached. Noting in passing: - Here is an example of how wait events can be viewed: + Here is are examples of how wait events can be vie

Re: WIP: new system catalog pg_wait_event

2023-08-18 Thread Michael Paquier
On Fri, Aug 18, 2023 at 10:56:55AM +0200, Drouvot, Bertrand wrote: > Okay, using the plural form in v8 attached. Noting in passing: - Here is an example of how wait events can be viewed: + Here is are examples of how wait events can be viewed: s/is are/are/. -- Michael signature.asc Desc

Re: WIP: new system catalog pg_wait_event

2023-08-18 Thread Michael Paquier
On Fri, Aug 18, 2023 at 10:57:28AM +0200, Drouvot, Bertrand wrote: > I did use "defined by an extension module" in v8 (also that's aligned with > the wording used in wait_event.h). WFM. -- Michael signature.asc Description: PGP signature

Re: WIP: new system catalog pg_wait_event

2023-08-18 Thread Drouvot, Bertrand
Hi, On 8/18/23 12:37 AM, Michael Paquier wrote: On Thu, Aug 17, 2023 at 04:37:22PM +0900, Masahiro Ikeda wrote: On 2023-08-17 14:53, Drouvot, Bertrand wrote: BTW, is it better to start with "Waiting" like any other lines? For example, "Waiting for custom event \"worker_spi_main\" defined by an

Re: WIP: new system catalog pg_wait_event

2023-08-18 Thread Drouvot, Bertrand
Hi, On 8/17/23 9:37 AM, Masahiro Ikeda wrote: Hi, On 2023-08-17 14:53, Drouvot, Bertrand wrote: The followings are additional comments for v7. 1) I am not sure that "pg_wait_event" is a good idea for the name if the new view.  How about "pg_wait_events" instead, in plural form?  There is mo

Re: WIP: new system catalog pg_wait_event

2023-08-17 Thread Michael Paquier
On Thu, Aug 17, 2023 at 04:37:22PM +0900, Masahiro Ikeda wrote: > On 2023-08-17 14:53, Drouvot, Bertrand wrote: > BTW, is it better to start with "Waiting" like any other lines? > For example, "Waiting for custom event \"worker_spi_main\" defined by an > extension". Using "Waiting for custom event

Re: WIP: new system catalog pg_wait_event

2023-08-17 Thread Masahiro Ikeda
Hi, On 2023-08-17 14:53, Drouvot, Bertrand wrote: On 8/17/23 3:53 AM, Masahiro Ikeda wrote: 1) The regular expression needs to be changed in generate-wait_event_types.pl. I have compared the documentation with the output of the pg_wait_event view and found the following differences. * For p

Re: WIP: new system catalog pg_wait_event

2023-08-16 Thread Drouvot, Bertrand
Hi, On 8/17/23 3:57 AM, Michael Paquier wrote: On Thu, Aug 17, 2023 at 10:53:02AM +0900, Masahiro Ikeda wrote: BTW, although I think this is outside the scope of this patch, it might be a good idea to be able to add a description to the API for custom wait events. Somebody on twitter has rais

Re: WIP: new system catalog pg_wait_event

2023-08-16 Thread Drouvot, Bertrand
Hi, On 8/17/23 3:53 AM, Masahiro Ikeda wrote: Hi, Thank you for creating the patch! I think it is a very useful view as a user. I will share some thoughts about the v6 patch. Thanks for looking at it! 1) The regular expression needs to be changed in generate-wait_event_types.pl. I have c

Re: WIP: new system catalog pg_wait_event

2023-08-16 Thread Drouvot, Bertrand
Hi, On 8/16/23 2:08 PM, Michael Paquier wrote: On Wed, Aug 16, 2023 at 01:43:35PM +0200, Drouvot, Bertrand wrote: Yeah, agree, done that way in v6 (also added a test in 001_worker_spi.pl to ensure that "worker_spi_main" is reported in pg_wait_event). -typedef struct WaitEventExtensionEntryByN

Re: WIP: new system catalog pg_wait_event

2023-08-16 Thread Masahiro Ikeda
On 2023-08-17 10:57, Michael Paquier wrote: On Thu, Aug 17, 2023 at 10:53:02AM +0900, Masahiro Ikeda wrote: BTW, although I think this is outside the scope of this patch, it might be a good idea to be able to add a description to the API for custom wait events. Somebody on twitter has raised t

Re: WIP: new system catalog pg_wait_event

2023-08-16 Thread Michael Paquier
On Thu, Aug 17, 2023 at 10:53:02AM +0900, Masahiro Ikeda wrote: > BTW, although I think this is outside the scope of this patch, > it might be a good idea to be able to add a description to the > API for custom wait events. Somebody on twitter has raised this point. I am not sure that we need to

Re: WIP: new system catalog pg_wait_event

2023-08-16 Thread Masahiro Ikeda
Hi, Thank you for creating the patch! I think it is a very useful view as a user. I will share some thoughts about the v6 patch. 1) The regular expression needs to be changed in generate-wait_event_types.pl. I have compared the documentation with the output of the pg_wait_event view and foun

Re: WIP: new system catalog pg_wait_event

2023-08-16 Thread Michael Paquier
On Wed, Aug 16, 2023 at 01:43:35PM +0200, Drouvot, Bertrand wrote: > Yeah, agree, done that way in v6 (also added a test in 001_worker_spi.pl > to ensure that "worker_spi_main" is reported in pg_wait_event). -typedef struct WaitEventExtensionEntryByName -{ - charwait_event_name[NAMEDATAL

Re: WIP: new system catalog pg_wait_event

2023-08-16 Thread Drouvot, Bertrand
Hi, On 8/16/23 8:22 AM, Michael Paquier wrote: On Wed, Aug 16, 2023 at 07:04:53AM +0200, Drouvot, Bertrand wrote: I'd prefer the singular form. There is a lot of places where it's already used (pg_database, pg_user, pg_namespace...to name a few) and it looks like that using the plural form are

Re: WIP: new system catalog pg_wait_event

2023-08-15 Thread Michael Paquier
On Wed, Aug 16, 2023 at 07:04:53AM +0200, Drouvot, Bertrand wrote: > I'd prefer the singular form. There is a lot of places where it's already used > (pg_database, pg_user, pg_namespace...to name a few) and it looks like that > using > the plural form are exceptions. Okay, fine by me. Also, I wo

Re: WIP: new system catalog pg_wait_event

2023-08-15 Thread Drouvot, Bertrand
Hi, On 8/14/23 6:37 AM, Michael Paquier wrote: On Thu, Aug 10, 2023 at 08:09:34PM +0200, Drouvot, Bertrand wrote: Agree that's worth it given the fact that iterating one more time is not that costly here. I have reviewed v4, and finished by putting my hands on it to see what I could do. Tha

Re: WIP: new system catalog pg_wait_event

2023-08-13 Thread Michael Paquier
On Thu, Aug 10, 2023 at 08:09:34PM +0200, Drouvot, Bertrand wrote: > Agree that's worth it given the fact that iterating one more time is not that > costly here. I have reviewed v4, and finished by putting my hands on it to see what I could do. +printf $wc "\telement = (wait_event_ele

Re: WIP: new system catalog pg_wait_event

2023-08-10 Thread Drouvot, Bertrand
Hi, On 8/9/23 9:56 AM, Michael Paquier wrote: On Tue, Aug 08, 2023 at 10:16:37AM +0200, Drouvot, Bertrand wrote: Please find attached v3 adding the wait event types. +-- There will surely be at least 9 wait event types, 240 wait events and at +-- least 27 related to WAL +select count(distinct

Re: WIP: new system catalog pg_wait_event

2023-08-09 Thread Michael Paquier
On Tue, Aug 08, 2023 at 10:16:37AM +0200, Drouvot, Bertrand wrote: > Please find attached v3 adding the wait event types. +-- There will surely be at least 9 wait event types, 240 wait events and at +-- least 27 related to WAL +select count(distinct(wait_event_type)) > 8 as ok_type, + count(

Re: WIP: new system catalog pg_wait_event

2023-08-08 Thread Drouvot, Bertrand
Hi, On 8/8/23 7:37 AM, Drouvot, Bertrand wrote: Hi, On 8/8/23 5:05 AM, Michael Paquier wrote: On Tue, Aug 08, 2023 at 11:53:32AM +0900, Kyotaro Horiguchi wrote: As I mentioned in another thread, I'm uncertain about our stance on the class id of the wait event. If a class acts as a namespace,

Re: WIP: new system catalog pg_wait_event

2023-08-07 Thread Drouvot, Bertrand
Hi, On 8/8/23 5:05 AM, Michael Paquier wrote: On Tue, Aug 08, 2023 at 11:53:32AM +0900, Kyotaro Horiguchi wrote: As I mentioned in another thread, I'm uncertain about our stance on the class id of the wait event. If a class acts as a namespace, we should include it in the view. Otherwise, if th

Re: WIP: new system catalog pg_wait_event

2023-08-07 Thread Michael Paquier
On Tue, Aug 08, 2023 at 11:53:32AM +0900, Kyotaro Horiguchi wrote: > As I mentioned in another thread, I'm uncertain about our stance on > the class id of the wait event. If a class acts as a namespace, we > should include it in the view. Otherwise, if the class id is just an > attribute of the wai

Re: WIP: new system catalog pg_wait_event

2023-08-07 Thread Kyotaro Horiguchi
At Mon, 7 Aug 2023 17:11:50 +0200, "Drouvot, Bertrand" wrote in > That way I think it's flexible enough to add more code if needed in > the SRF. > > The patch also: > > - updates the doc > - works with autoconf and meson > - adds a simple test > > I'm adding a new CF entry for it. As I menti

Re: WIP: new system catalog pg_wait_event

2023-08-07 Thread Drouvot, Bertrand
Hi, On 8/7/23 10:23 AM, Drouvot, Bertrand wrote: Hi, On 8/4/23 5:08 PM, Tom Lane wrote: "Drouvot, Bertrand" writes: Now that fa88928470 generates automatically code and documentation related to wait events, why not exposing the wait events description through a system catalog relation? I t

Re: WIP: new system catalog pg_wait_event

2023-08-07 Thread Drouvot, Bertrand
Hi, On 8/4/23 5:08 PM, Tom Lane wrote: "Drouvot, Bertrand" writes: Now that fa88928470 generates automatically code and documentation related to wait events, why not exposing the wait events description through a system catalog relation? I think you'd be better off making this a view over a

Re: WIP: new system catalog pg_wait_event

2023-08-04 Thread Tom Lane
"Drouvot, Bertrand" writes: > Now that fa88928470 generates automatically code and documentation > related to wait events, why not exposing the wait events description > through a system catalog relation? I think you'd be better off making this a view over a set-returning function. The nearby wo

WIP: new system catalog pg_wait_event

2023-08-04 Thread Drouvot, Bertrand
Hi hackers, Now that fa88928470 generates automatically code and documentation related to wait events, why not exposing the wait events description through a system catalog relation? (the idea has been proposed on twitter by Yves Colin [1]). I think that could be useful to: - join this new rela