Thread: session time
Help requested: Is there any way to get the session time with a query. All I afforded to get is the start time of statement execution. HLP PLZ
Anass HAMMEDI wrote: > > Help requested: > > Is there any way to get the session time with a query. > All I afforded to get is the start time of statement execution. You want session start time? We don't supply that. My only suggestion would be to create a temp table on session start and put current_timestamp into there. -- Bruce Momjian | http://candle.pha.pa.us pgman@candle.pha.pa.us | (610) 359-1001 + If your life is a hard drive, | 13 Roberts Road + Christ can be your backup. | Newtown Square, Pennsylvania 19073
Bruce Momjian said: > Anass HAMMEDI wrote: >> >> Help requested: >> >> Is there any way to get the session time with a query. >> All I afforded to get is the start time of statement execution. > > You want session start time? We don't supply that. My only suggestion > would be to create a temp table on session start and put > current_timestamp into there. > log_line-prefex on 7.5 does session start time. We could also add a 'time since session start' if that was wanted quite easily. cheers andrew
I 'm trying to convince my chief to add PostgreSQL to RDBMS 's our software supports. I need to know how to get the session time by a simple query , to prohibit idling on the server. I think this feature would be useful not just for me , so if it can be added ,please, give it your best shot. Thanx Anass -----Message d'origine----- De : Andrew Dunstan [mailto:andrew@dunslane.net] Envoyé : mardi 6 juillet 2004 16:57 À : pgman@candle.pha.pa.us Cc : Anass.HAMMEDI@asais.fr; pgsql-hackers-win32@postgresql.org Objet : Re: [pgsql-hackers-win32] session time Bruce Momjian said: > Anass HAMMEDI wrote: >> >> Help requested: >> >> Is there any way to get the session time with a query. >> All I afforded to get is the start time of statement execution. > > You want session start time? We don't supply that. My only suggestion > would be to create a temp table on session start and put > current_timestamp into there. > log_line-prefex on 7.5 does session start time. We could also add a 'time since session start' if that was wanted quite easily. cheers andrew
If you want it by a query, then log_prefix is not going to help :-( It could perhaps be added as a column to pg_stat_activity? (Which has query_start at the moment, could also have session_start)Not having looked into the details, that could probably be added fairly easy. But I assume it's too late to get something like that into 7.5, even if it's really small :-( Or? //Magnus > -----Original Message----- > From: Anass HAMMEDI [mailto:Anass.HAMMEDI@asais.fr] > Sent: Wednesday, July 07, 2004 10:45 AM > To: Andrew Dunstan; pgman@candle.pha.pa.us > Cc: pgsql-hackers-win32@postgresql.org > Subject: Re: [pgsql-hackers-win32] session time > > I 'm trying to convince my chief to add PostgreSQL to RDBMS > 's our software supports. > I need to know how to get the session time by a simple query > , to prohibit idling on the server. > > I think this feature would be useful not just for me , so if > it can be added ,please, give it your best shot. > > Thanx > > Anass > > -----Message d'origine----- > De : Andrew Dunstan [mailto:andrew@dunslane.net] Envoyé : > mardi 6 juillet 2004 16:57 À : pgman@candle.pha.pa.us Cc : > Anass.HAMMEDI@asais.fr; pgsql-hackers-win32@postgresql.org > Objet : Re: [pgsql-hackers-win32] session time > > > Bruce Momjian said: > > Anass HAMMEDI wrote: > >> > >> Help requested: > >> > >> Is there any way to get the session time with a query. > >> All I afforded to get is the start time of statement execution. > > > > You want session start time? We don't supply that. My only > > suggestion would be to create a temp table on session start and put > > current_timestamp into there. > > > > log_line-prefex on 7.5 does session start time. We could also > add a 'time since session start' if that was wanted quite easily. > > cheers > > andrew > > > ---------------------------(end of > broadcast)--------------------------- > TIP 7: don't forget to increase your free space map settings > >
Added to TODO: * Add session start time and last statement time to pg_stat_activity --------------------------------------------------------------------------- Magnus Hagander wrote: > If you want it by a query, then log_prefix is not going to help :-( > > It could perhaps be added as a column to pg_stat_activity? (Which has query_start at the moment, could also have session_start)Not having looked into the details, that could probably be added fairly easy. > > But I assume it's too late to get something like that into 7.5, even if it's really small :-( Or? > > //Magnus > > > > -----Original Message----- > > From: Anass HAMMEDI [mailto:Anass.HAMMEDI@asais.fr] > > Sent: Wednesday, July 07, 2004 10:45 AM > > To: Andrew Dunstan; pgman@candle.pha.pa.us > > Cc: pgsql-hackers-win32@postgresql.org > > Subject: Re: [pgsql-hackers-win32] session time > > > > I 'm trying to convince my chief to add PostgreSQL to RDBMS > > 's our software supports. > > I need to know how to get the session time by a simple query > > , to prohibit idling on the server. > > > > I think this feature would be useful not just for me , so if > > it can be added ,please, give it your best shot. > > > > Thanx > > > > Anass > > > > -----Message d'origine----- > > De : Andrew Dunstan [mailto:andrew@dunslane.net] Envoy? : > > mardi 6 juillet 2004 16:57 ? : pgman@candle.pha.pa.us Cc : > > Anass.HAMMEDI@asais.fr; pgsql-hackers-win32@postgresql.org > > Objet : Re: [pgsql-hackers-win32] session time > > > > > > Bruce Momjian said: > > > Anass HAMMEDI wrote: > > >> > > >> Help requested: > > >> > > >> Is there any way to get the session time with a query. > > >> All I afforded to get is the start time of statement execution. > > > > > > You want session start time? We don't supply that. My only > > > suggestion would be to create a temp table on session start and put > > > current_timestamp into there. > > > > > > > log_line-prefex on 7.5 does session start time. We could also > > add a 'time since session start' if that was wanted quite easily. > > > > cheers > > > > andrew > > > > > > ---------------------------(end of > > broadcast)--------------------------- > > TIP 7: don't forget to increase your free space map settings > > > > > -- Bruce Momjian | http://candle.pha.pa.us pgman@candle.pha.pa.us | (610) 359-1001 + If your life is a hard drive, | 13 Roberts Road + Christ can be your backup. | Newtown Square, Pennsylvania 19073