Re: Add session statistics to pg_stat_database

2021-01-18 Thread Magnus Hagander
On Mon, Jan 18, 2021 at 5:11 PM Laurenz Albe wrote: > > On Sun, 2021-01-17 at 14:07 +0100, Magnus Hagander wrote: > > I have applied this version, with some minor changes: > > > > * I renamed the n__time members in the struct to just > > total__time. The n_ indicates "number of" and is thus wrong

Re: Add session statistics to pg_stat_database

2021-01-18 Thread Laurenz Albe
On Sun, 2021-01-17 at 14:07 +0100, Magnus Hagander wrote: > I have applied this version, with some minor changes: > > * I renamed the n__time members in the struct to just > total__time. The n_ indicates "number of" and is thus wrong for > time parameters. Right. > * Some very minor wording chan

Re: Add session statistics to pg_stat_database

2021-01-17 Thread Magnus Hagander
On Fri, Jan 8, 2021 at 10:34 AM Laurenz Albe wrote: > > On Fri, 2021-01-08 at 12:00 +0900, Masahiro Ikeda wrote: > > 2. monitoring.sgml > > > > > > IIUC, "active_time" includes the time executes a fast-path function > > > > and > > > > "idle in transaction" includes "idle in transaction(aborted)"

Re: Add session statistics to pg_stat_database

2021-01-08 Thread Masahiro Ikeda
On 2021-01-08 18:34, Laurenz Albe wrote: On Fri, 2021-01-08 at 12:00 +0900, Masahiro Ikeda wrote: 2. monitoring.sgml > > IIUC, "active_time" includes the time executes a fast-path function > > and > > "idle in transaction" includes "idle in transaction(aborted)" time. > > Why don't you referenc

Re: Add session statistics to pg_stat_database

2021-01-08 Thread Laurenz Albe
On Fri, 2021-01-08 at 12:00 +0900, Masahiro Ikeda wrote: > 2. monitoring.sgml > > > > IIUC, "active_time" includes the time executes a fast-path function > > > and > > > "idle in transaction" includes "idle in transaction(aborted)" time. > > > Why don't you reference pg_stat_activity's "state" co

Re: Add session statistics to pg_stat_database

2021-01-07 Thread Masahiro Ikeda
On 2021-01-08 00:47, Laurenz Albe wrote: On Fri, 2020-12-25 at 20:28 +0900, Masahiro Ikeda wrote: As a user, I want this feature to know whether clients' session activities are as expected. I have some comments about the patch. Thanks you for the thorough review! Thanks for updating the pat

Re: Add session statistics to pg_stat_database

2021-01-07 Thread Laurenz Albe
On Fri, 2020-12-25 at 20:28 +0900, Masahiro Ikeda wrote: > As a user, I want this feature to know whether > clients' session activities are as expected. > > I have some comments about the patch. Thanks you for the thorough review! > 1. pg_proc.dat > > The unit of "session time" and so on says "

Re: Add session statistics to pg_stat_database

2020-12-27 Thread Laurenz Albe
On Fri, 2020-12-25 at 20:28 +0900, Masahiro Ikeda wrote: > As a user, I want this feature to know whether > clients' session activities are as expected. > > I have some comments about the patch. > > 1. pg_proc.dat > > The unit of "session time" and so on says "in seconds". > But, is "in millisec

Re: Add session statistics to pg_stat_database

2020-12-25 Thread Masahiro Ikeda
Hi, As a user, I want this feature to know whether clients' session activities are as expected. I have some comments about the patch. 1. pg_proc.dat The unit of "session time" and so on says "in seconds". But, is "in milliseconds" right? 2. monitoring.sgml IIUC, "active_time" includes the

Re: Add session statistics to pg_stat_database

2020-12-15 Thread Laurenz Albe
On Tue, 2020-12-15 at 13:53 +0100, Laurenz Albe wrote: > Attached is patch version 9. Aah, I forgot the ++. Version 10 attached. Yours, Laurenz Albe From b40e34141c80ff59c0005f430bd8c273918eb7bb Mon Sep 17 00:00:00 2001 From: Laurenz Albe Date: Tue, 15 Dec 2020 13:46:44 +0100 Subject: [PATCH] Ad

Re: Add session statistics to pg_stat_database

2020-12-15 Thread Laurenz Albe
On Sun, 2020-12-13 at 17:49 +0100, Magnus Hagander wrote: > > > I am considering the cases > > > > > > 1) client just went away (currently "aborted") > > > 2) death by FATAL error > > > 3) killed by the administrator (or shutdown) > > > > I named the three counters "sessions_client_eof", "session

Re: Add session statistics to pg_stat_database

2020-12-13 Thread Magnus Hagander
On Sat, Dec 5, 2020 at 1:04 PM Laurenz Albe wrote: > On Fri, 2020-12-04 at 16:55 +0100, I wrote: > > > > Basically, that would change pgStatSessionDisconnectedNormally into > instead being an > > > > enum of reasons, which could be normal disconnect, abnormal > disconnect and admin. > > > > And w

Re: Add session statistics to pg_stat_database

2020-12-05 Thread Laurenz Albe
On Fri, 2020-12-04 at 16:55 +0100, I wrote: > > > Basically, that would change pgStatSessionDisconnectedNormally into > > > instead being an > > > enum of reasons, which could be normal disconnect, abnormal disconnect > > > and admin. > > > And we'd track all those three as separate numbers in th

Re: Add session statistics to pg_stat_database

2020-12-04 Thread Laurenz Albe
On Thu, 2020-12-03 at 13:22 +0100, Laurenz Albe wrote: > > Basically, that would change pgStatSessionDisconnectedNormally into instead > > being an > > enum of reasons, which could be normal disconnect, abnormal disconnect and > > admin. > > And we'd track all those three as separate numbers in t

Re: Add session statistics to pg_stat_database

2020-12-03 Thread Laurenz Albe
On Tue, 2020-12-01 at 17:32 +0100, Magnus Hagander wrote: > > I have changed "connections" to "sessions" and renamed the new > > column "connections" to "session_count". > > > > I think that most people will understand a session as started after a > > successful > > connection. > > Yeah, I agree

Re: Add session statistics to pg_stat_database

2020-12-01 Thread Magnus Hagander
On Fri, Nov 20, 2020 at 3:41 PM Laurenz Albe wrote: > On Tue, 2020-11-17 at 17:33 +0100, Magnus Hagander wrote: > > I've taken a look as well, and here are a few short notes: > > Much appreciated! > Sorry about the delay in getting back to you on this one. FYI, while the patch has been bumped to

Re: Add session statistics to pg_stat_database

2020-11-20 Thread Laurenz Albe
On Tue, 2020-11-17 at 17:33 +0100, Magnus Hagander wrote: > I've taken a look as well, and here are a few short notes: Much appreciated! > * It talks about "number of connections" but "number of aborted sessions". We > should probably > be consistent about talking either about connections or s

Re: Add session statistics to pg_stat_database

2020-11-17 Thread Magnus Hagander
On Tue, Nov 17, 2020 at 4:22 PM Laurenz Albe wrote: > On Fri, 2020-10-16 at 16:24 +0500, Ahsan Hadi wrote: > > I have applied the latest patch on master, all the regression test cases > are passing > > and the implemented functionality is also looking fine. The point that > I raised about > > i

Re: Add session statistics to pg_stat_database

2020-11-17 Thread Laurenz Albe
On Fri, 2020-10-16 at 16:24 +0500, Ahsan Hadi wrote: > I have applied the latest patch on master, all the regression test cases are > passing > and the implemented functionality is also looking fine. The point that I > raised about > idle connection not included is also addressed. If you think

Re: Add session statistics to pg_stat_database

2020-11-12 Thread Georgios
‐‐‐ Original Message ‐‐‐ On Thursday, November 12, 2020 9:31 AM, Laurenz Albe wrote: > I wrote: > > > On Tue, 2020-11-10 at 15:03 +, Georgios Kokolatos wrote: > > > > > I noticed that the cfbot fails for this patch. > > > For this, I am setting the status to: 'Waiting on Author'.

Re: Add session statistics to pg_stat_database

2020-11-12 Thread Laurenz Albe
I wrote: > On Tue, 2020-11-10 at 15:03 +, Georgios Kokolatos wrote: > > I noticed that the cfbot fails for this patch. > > > > For this, I am setting the status to: 'Waiting on Author'. > > Thanks for noticing, it was only the documentation build. > > Version 5 attached, status changed back

Re: Add session statistics to pg_stat_database

2020-11-11 Thread Laurenz Albe
On Tue, 2020-11-10 at 15:03 +, Georgios Kokolatos wrote: > I noticed that the cfbot fails for this patch. > > For this, I am setting the status to: 'Waiting on Author'. Thanks for noticing, it was only the documentation build. Version 5 attached, status changed back to "waiting for review".

Re: Add session statistics to pg_stat_database

2020-11-10 Thread Georgios Kokolatos
Hi, I noticed that the cfbot fails for this patch. For this, I am setting the status to: 'Waiting on Author'. Cheers, //Georgios The new status of this patch is: Waiting on Author

Re: Add session statistics to pg_stat_database

2020-10-16 Thread Ahsan Hadi
Hi Laurenz, I have applied the latest patch on master, all the regression test cases are passing and the implemented functionality is also looking fine. The point that I raised about idle connection not included is also addressed. thanks, Ahsan On Wed, Oct 14, 2020 at 2:28 PM Laurenz Albe wrote

Re: Add session statistics to pg_stat_database

2020-10-14 Thread Laurenz Albe
Thanks for the --- as always --- valuable review! On Tue, 2020-10-13 at 17:55 -0500, Justin Pryzby wrote: > On Tue, Oct 13, 2020 at 01:44:41PM +0200, Laurenz Albe wrote: > > Attached is v3 with improvements. > > + > + Time spent in database sessions in this database, in milliseconds.

Re: Add session statistics to pg_stat_database

2020-10-13 Thread Justin Pryzby
On Tue, Oct 13, 2020 at 01:44:41PM +0200, Laurenz Albe wrote: > Attached is v3 with improvements. + + Time spent in database sessions in this database, in milliseconds. + Should say "Total time spent *by* DB sessions..." ? I think these counters are only accurate as of the last

Re: Add session statistics to pg_stat_database

2020-10-13 Thread Laurenz Albe
On Fri, 2020-10-02 at 15:10 -0700, Soumyadeep Chakraborty wrote: > On Tue, Sep 29, 2020 at 2:44 AM Laurenz Albe wrote: > > > * Are we trying to capture ONLY client initiated disconnects in > > > m_aborted (we are not handling other disconnects by not accounting for > > > EOF..like if psql was kill

Re: Add session statistics to pg_stat_database

2020-10-06 Thread Masahiro Ikeda
On 2020-09-05 00:50, Laurenz Albe wrote: I have changed the code so that connections are counted immediately. Attached is a new version. Thanks for making a patch. I'm interested in this feature. I think to add the number of login failures is good for security. Although we can see the event fr

Re: Add session statistics to pg_stat_database

2020-10-02 Thread Soumyadeep Chakraborty
On Tue, Sep 29, 2020 at 2:44 AM Laurenz Albe wrote: > > * Are we trying to capture ONLY client initiated disconnects in > > m_aborted (we are not handling other disconnects by not accounting for > > EOF..like if psql was killed)? If yes, why? > > I thought it was interesting to know how many dat

Re: Add session statistics to pg_stat_database

2020-09-29 Thread Laurenz Albe
On Thu, 2020-09-24 at 14:38 -0700, Soumyadeep Chakraborty wrote: > Thanks for submitting this! Please find my feedback below. Thanks for the thorough review. Before I update the patch, I have a few comments and questions. > * Are we trying to capture ONLY client initiated disconnects in > m_abor

Re: Add session statistics to pg_stat_database

2020-09-24 Thread Soumyadeep Chakraborty
Hello Laurenz, Thanks for submitting this! Please find my feedback below. * Are we trying to capture ONLY client initiated disconnects in m_aborted (we are not handling other disconnects by not accounting for EOF..like if psql was killed)? If yes, why? * pgstat_send_connstats(): How about renami

Re: Add session statistics to pg_stat_database

2020-09-04 Thread Laurenz Albe
On Tue, 2020-08-11 at 13:53 +0200, I wrote: > On Thu, 2020-07-23 at 18:16 +0500, Ahsan Hadi wrote: > > > On Wed, Jul 8, 2020 at 4:17 PM Laurenz Albe > > wrote: > > > Here is a patch that adds the following to pg_stat_database: > > > - number of connections > > > > Is it expected behaviour to not

Re: Add session statistics to pg_stat_database

2020-08-11 Thread Laurenz Albe
On Thu, 2020-07-23 at 18:16 +0500, Ahsan Hadi wrote: > On Wed, Jul 8, 2020 at 4:17 PM Laurenz Albe wrote: > > Here is a patch that adds the following to pg_stat_database: > > - number of connections > > Is it expected behaviour to not count idle connections? The connection is > included after it

Re: Add session statistics to pg_stat_database

2020-07-23 Thread Ahsan Hadi
On Wed, Jul 8, 2020 at 4:17 PM Laurenz Albe wrote: > Here is a patch that adds the following to pg_stat_database: > - number of connections > Is it expected behaviour to not count idle connections? The connection is included after it is aborted but not while it was idle. > - number of sessions