pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Monitoring a Query
20+ messages / 7 participants
[nested] [flat]

* Monitoring a Query
@ 2002-09-20 15:34  Aaron Held <aaron@MetroNY.com>
  0 siblings, 2 replies; 20+ messages in thread

From: Aaron Held @ 2002-09-20 15:34 UTC (permalink / raw)
  To: pgsql-sql; +Cc: pgsql-general@postgresql.org

Is there any way to monitor a long running query?

I have stats turned on and I can see my queries, but is there any better 
measure of the progress?

Thanks,
-Aaron Held

select current_query from pg_stat_activity;
current_query

<IDLE>
<IDLE>
<IDLE>
<IDLE>
<IDLE> in transaction
FETCH ALL FROM PgSQL_470AEE94
<IDLE> in transaction
select * from "Calls" WHERE "DurationOfCall" = 2.5 AND "DateOfCall" = 
'7/01/02' AND ("GroupCode" = 'MIAMI' OR "GroupCode" = 'Salt Lake');
<IDLE>
<IDLE>
<IDLE>




^ permalink  raw  reply  [nested|flat] 20+ messages in thread

* Re: Monitoring a Query
@ 2002-09-20 16:18  Bruce Momjian <pgman@candle.pha.pa.us>
  parent: Aaron Held <aaron@MetroNY.com>
  1 sibling, 0 replies; 20+ messages in thread

From: Bruce Momjian @ 2002-09-20 16:18 UTC (permalink / raw)
  To: Aaron Held <aaron@MetroNY.com>; +Cc: pgsql-sql; pgsql-general@postgresql.org


There is pgmonitor:

	http://gborg.postgresql.org/project/pgmonitor

---------------------------------------------------------------------------

Aaron Held wrote:
> Is there any way to monitor a long running query?
> 
> I have stats turned on and I can see my queries, but is there any better 
> measure of the progress?
> 
> Thanks,
> -Aaron Held
> 
> select current_query from pg_stat_activity;
> current_query
> 
> <IDLE>
> <IDLE>
> <IDLE>
> <IDLE>
> <IDLE> in transaction
> FETCH ALL FROM PgSQL_470AEE94
> <IDLE> in transaction
> select * from "Calls" WHERE "DurationOfCall" = 2.5 AND "DateOfCall" = 
> '7/01/02' AND ("GroupCode" = 'MIAMI' OR "GroupCode" = 'Salt Lake');
> <IDLE>
> <IDLE>
> <IDLE>
> 
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
>     (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)
> 

-- 
  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



^ permalink  raw  reply  [nested|flat] 20+ messages in thread

* Re: Monitoring a Query
@ 2002-09-20 16:19  Bruce Momjian <pgman@candle.pha.pa.us>
  parent: Aaron Held <aaron@MetroNY.com>
  1 sibling, 1 reply; 20+ messages in thread

From: Bruce Momjian @ 2002-09-20 16:19 UTC (permalink / raw)
  To: Aaron Held <aaron@MetroNY.com>; +Cc: pgsql-sql; pgsql-general@postgresql.org

Aaron Held wrote:
> Is there any way to monitor a long running query?
> 
> I have stats turned on and I can see my queries, but is there any better 
> measure of the progress?

Oh, sorry, you want to know how far the query has progressed.  Gee, I
don't think there is any easy way to do that.  Sorry.

-- 
  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



^ permalink  raw  reply  [nested|flat] 20+ messages in thread

* Re: Monitoring a Query
@ 2002-09-20 18:56  Bruce Momjian <pgman@candle.pha.pa.us>
  1 sibling, 0 replies; 20+ messages in thread

From: Bruce Momjian @ 2002-09-20 18:56 UTC (permalink / raw)
  To: wsheldah@lexmark.com; +Cc: Aaron Held <aaron@MetroNY.com>; pgsql-sql; pgsql-general@postgresql.org


Uh, no, not yet.  There is a non-X version of tcl but I don't think
pgaccess will work under that.

---------------------------------------------------------------------------

wsheldah@lexmark.com wrote:
> 
> I just downloaded and installed pgmonitor on my dev. machine after seeing
> your post, and it looks nifty. Only problem is I really want to avoid
> running X on the database server to conserve the RAM it uses, and this
> appears to require X. Any terminal applications to monitor database
> activity, perhaps loosely analagous to mtop for MySQL?
> (http://mtop.sf.net/)
> 
> Wes Sheldahl
> 
> 
> 
> 
> Bruce Momjian <pgman@candle.pha.pa.us>@postgresql.org on 09/20/2002
> 12:18:06 PM
> 
> Sent by:    pgsql-general-owner@postgresql.org
> 
> 
> To:    Aaron Held <aaron@MetroNY.com>
> cc:    pgsql-sql@postgresql.org, pgsql-general@postgresql.org
> Subject:    Re: [GENERAL] Monitoring a Query
> 
> 
> 
> There is pgmonitor:
> 
>  http://gborg.postgresql.org/project/pgmonitor
> 
> ---------------------------------------------------------------------------
> 
> Aaron Held wrote:
> > Is there any way to monitor a long running query?
> >
> > I have stats turned on and I can see my queries, but is there any better
> > measure of the progress?
> >
> > Thanks,
> > -Aaron Held
> >
> > select current_query from pg_stat_activity;
> > current_query
> >
> > <IDLE>
> > <IDLE>
> > <IDLE>
> > <IDLE>
> > <IDLE> in transaction
> > FETCH ALL FROM PgSQL_470AEE94
> > <IDLE> in transaction
> > select * from "Calls" WHERE "DurationOfCall" = 2.5 AND "DateOfCall" =
> > '7/01/02' AND ("GroupCode" = 'MIAMI' OR "GroupCode" = 'Salt Lake');
> > <IDLE>
> > <IDLE>
> > <IDLE>
> >
> >
> > ---------------------------(end of broadcast)---------------------------
> > TIP 2: you can get off all lists at once with the unregister command
> >     (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)
> >
> 
> --
>   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
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 6: Have you searched our list archives?
> 
> http://archives.postgresql.org
> 
> 
> 
> 
> 

-- 
  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



^ permalink  raw  reply  [nested|flat] 20+ messages in thread

* Re: Monitoring a Query
@ 2002-09-20 19:13  Aaron Held <aaron@MetroNY.com>
  1 sibling, 0 replies; 20+ messages in thread

From: Aaron Held @ 2002-09-20 19:13 UTC (permalink / raw)
  To: wsheldah@lexmark.com; +Cc: Bruce Momjian <pgman@candle.pha.pa.us>; pgsql-sql; pgsql-general@postgresql.org

There are some good views and functions you can use to get at the SQL 
query being executed

try turning on the stats collector and running
select * from pg_stat_activity;

(See http://www.postgresql.org/idocs/index.php?monitoring-stats.html )

You can also see the procID.
 From Python I can use this info to get a lot of details about the 
running query, CPU and memory use.

But I can't tell how far along it actually is.

-Aaron

wsheldah@lexmark.com wrote:
> I just downloaded and installed pgmonitor on my dev. machine after seeing
> your post, and it looks nifty. Only problem is I really want to avoid
> running X on the database server to conserve the RAM it uses, and this
> appears to require X. Any terminal applications to monitor database
> activity, perhaps loosely analagous to mtop for MySQL?
> (http://mtop.sf.net/)
> 
> Wes Sheldahl
> 
> 
> 
> 
> Bruce Momjian <pgman@candle.pha.pa.us>@postgresql.org on 09/20/2002
> 12:18:06 PM
> 
> Sent by:    pgsql-general-owner@postgresql.org
> 
> 
> To:    Aaron Held <aaron@MetroNY.com>
> cc:    pgsql-sql@postgresql.org, pgsql-general@postgresql.org
> Subject:    Re: [GENERAL] Monitoring a Query
> 
> 
> 
> There is pgmonitor:
> 
>  http://gborg.postgresql.org/project/pgmonitor
> 
> ---------------------------------------------------------------------------
> 
> Aaron Held wrote:
> 
>>Is there any way to monitor a long running query?
>>
>>I have stats turned on and I can see my queries, but is there any better
>>measure of the progress?
>>
>>Thanks,
>>-Aaron Held
>>
>>select current_query from pg_stat_activity;
>>current_query
>>
>><IDLE>
>><IDLE>
>><IDLE>
>><IDLE>
>><IDLE> in transaction
>>FETCH ALL FROM PgSQL_470AEE94
>><IDLE> in transaction
>>select * from "Calls" WHERE "DurationOfCall" = 2.5 AND "DateOfCall" =
>>'7/01/02' AND ("GroupCode" = 'MIAMI' OR "GroupCode" = 'Salt Lake');
>><IDLE>
>><IDLE>
>><IDLE>
>>
>>
>>---------------------------(end of broadcast)---------------------------
>>TIP 2: you can get off all lists at once with the unregister command
>>    (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)
>>
> 
> 
> --
>   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
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 6: Have you searched our list archives?
> 
> http://archives.postgresql.org
> 
> 
> 





^ permalink  raw  reply  [nested|flat] 20+ messages in thread

* Re: Monitoring a Query
@ 2002-09-20 19:54  Neil Conway <neilc@samurai.com>
  parent: Bruce Momjian <pgman@candle.pha.pa.us>
  0 siblings, 1 reply; 20+ messages in thread

From: Neil Conway @ 2002-09-20 19:54 UTC (permalink / raw)
  To: Bruce Momjian <pgman@candle.pha.pa.us>; +Cc: Aaron Held <aaron@MetroNY.com>; pgsql-sql; pgsql-general@postgresql.org

Bruce Momjian <pgman@candle.pha.pa.us> writes:
> Aaron Held wrote:
> > Is there any way to monitor a long running query?
> 
> Oh, sorry, you want to know how far the query has progressed.  Gee, I
> don't think there is any easy way to do that.

Would it be a good idea to add the time that the current query began
execution at to pg_stat_activity?

Cheers,

Neil

-- 
Neil Conway <neilc@samurai.com> || PGP Key ID: DB3C29FC




^ permalink  raw  reply  [nested|flat] 20+ messages in thread

* Re: Monitoring a Query
@ 2002-09-23 01:51  Bruce Momjian <pgman@candle.pha.pa.us>
  parent: Neil Conway <neilc@samurai.com>
  0 siblings, 2 replies; 20+ messages in thread

From: Bruce Momjian @ 2002-09-23 01:51 UTC (permalink / raw)
  To: Neil Conway <neilc@samurai.com>; +Cc: Aaron Held <aaron@MetroNY.com>; pgsql-sql; pgsql-general@postgresql.org

Neil Conway wrote:
> Bruce Momjian <pgman@candle.pha.pa.us> writes:
> > Aaron Held wrote:
> > > Is there any way to monitor a long running query?
> > 
> > Oh, sorry, you want to know how far the query has progressed.  Gee, I
> > don't think there is any easy way to do that.
> 
> Would it be a good idea to add the time that the current query began
> execution at to pg_stat_activity?

What do people think about this?  It seems like a good idea to me.

-- 
  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



^ permalink  raw  reply  [nested|flat] 20+ messages in thread

* Re: Monitoring a Query
@ 2002-09-23 13:24  Aaron Held <aaron@MetroNY.com>
  parent: Bruce Momjian <pgman@candle.pha.pa.us>
  1 sibling, 0 replies; 20+ messages in thread

From: Aaron Held @ 2002-09-23 13:24 UTC (permalink / raw)
  To: Bruce Momjian <pgman@candle.pha.pa.us>; +Cc: Neil Conway <neilc@samurai.com>; pgsql-sql; pgsql-general@postgresql.org

Bruce Momjian wrote:
> Neil Conway wrote:
> 
>>Bruce Momjian <pgman@candle.pha.pa.us> writes:
>>
>>>Aaron Held wrote:
>>>
>>>>Is there any way to monitor a long running query?
>>>
>>>Oh, sorry, you want to know how far the query has progressed.  Gee, I
>>>don't think there is any easy way to do that.
>>
>>Would it be a good idea to add the time that the current query began
>>execution at to pg_stat_activity?
> 
> 
> What do people think about this?  It seems like a good idea to me.
> 

My application marks the start time of each query and I have found it 
very useful.  The users like to see how long each query took, and the 
admin can take a quick look and see how many queries are running and how 
long each has been active for.  Good for debugging and billing.

-Aaron Held




^ permalink  raw  reply  [nested|flat] 20+ messages in thread

* Re: [GENERAL] Monitoring a Query
@ 2002-09-23 13:47  Roberto Mello <rmello@cc.usu.edu>
  parent: Bruce Momjian <pgman@candle.pha.pa.us>
  1 sibling, 2 replies; 20+ messages in thread

From: Roberto Mello @ 2002-09-23 13:47 UTC (permalink / raw)
  To: Bruce Momjian <pgman@candle.pha.pa.us>; +Cc: Neil Conway <neilc@samurai.com>; Aaron Held <aaron@MetroNY.com>; pgsql-sql; pgsql-general@postgresql.org

On Sun, Sep 22, 2002 at 09:51:55PM -0400, Bruce Momjian wrote:
> > 
> > Would it be a good idea to add the time that the current query began
> > execution at to pg_stat_activity?
> 
> What do people think about this?  It seems like a good idea to me.

OpenACS has a package called "Developer Support" that shows you (among
other things) how long a query took to be executed. Very good to finding 
out slow-running queries that need to be optimized.

-Roberto

-- 
+----|        Roberto Mello   -    http://www.brasileiro.net/  |------+
+       USU Free Software & GNU/Linux Club - http://fslc.usu.edu/     +



^ permalink  raw  reply  [nested|flat] 20+ messages in thread

* Re: [SQL] Monitoring a Query
@ 2002-09-23 14:31  Aaron Held <aaron@MetroNY.com>
  parent: Roberto Mello <rmello@cc.usu.edu>
  1 sibling, 1 reply; 20+ messages in thread

From: Aaron Held @ 2002-09-23 14:31 UTC (permalink / raw)
  To: Roberto Mello <rmello@cc.usu.edu>; +Cc: Bruce Momjian <pgman@candle.pha.pa.us>; Neil Conway <neilc@samurai.com>; pgsql-sql; pgsql-general@postgresql.org

It looks like that just timestamps things in its connection pool, that 
is what I do now.

What I would like is to know about queries that have not finished yet.

-Aaron

Roberto Mello wrote:
> On Sun, Sep 22, 2002 at 09:51:55PM -0400, Bruce Momjian wrote:
> 
>>>Would it be a good idea to add the time that the current query began
>>>execution at to pg_stat_activity?
>>
>>What do people think about this?  It seems like a good idea to me.
> 
> 
> OpenACS has a package called "Developer Support" that shows you (among
> other things) how long a query took to be executed. Very good to finding 
> out slow-running queries that need to be optimized.
> 
> -Roberto
> 





^ permalink  raw  reply  [nested|flat] 20+ messages in thread

* Re: [SQL] Monitoring a Query
@ 2002-09-23 14:48  Bruce Momjian <pgman@candle.pha.pa.us>
  parent: Roberto Mello <rmello@cc.usu.edu>
  1 sibling, 1 reply; 20+ messages in thread

From: Bruce Momjian @ 2002-09-23 14:48 UTC (permalink / raw)
  To: Roberto Mello <rmello@cc.usu.edu>; +Cc: Neil Conway <neilc@samurai.com>; Aaron Held <aaron@MetroNY.com>; pgsql-sql; pgsql-general@postgresql.org

Roberto Mello wrote:
> On Sun, Sep 22, 2002 at 09:51:55PM -0400, Bruce Momjian wrote:
> > > 
> > > Would it be a good idea to add the time that the current query began
> > > execution at to pg_stat_activity?
> > 
> > What do people think about this?  It seems like a good idea to me.
> 
> OpenACS has a package called "Developer Support" that shows you (among
> other things) how long a query took to be executed. Very good to finding 
> out slow-running queries that need to be optimized.

7.3 will have GUC 'log_duration' which will show query duration.

-- 
  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



^ permalink  raw  reply  [nested|flat] 20+ messages in thread

* Re: [SQL] Monitoring a Query
@ 2002-09-23 14:49  Bruce Momjian <pgman@candle.pha.pa.us>
  parent: Aaron Held <aaron@MetroNY.com>
  0 siblings, 1 reply; 20+ messages in thread

From: Bruce Momjian @ 2002-09-23 14:49 UTC (permalink / raw)
  To: Aaron Held <aaron@MetroNY.com>; +Cc: Roberto Mello <rmello@cc.usu.edu>; Neil Conway <neilc@samurai.com>; pgsql-sql; pgsql-general@postgresql.org

Aaron Held wrote:
> It looks like that just timestamps things in its connection pool, that 
> is what I do now.
> 
> What I would like is to know about queries that have not finished yet.

OK, added to TODO:

	* Add start time to pg_stat_activity

Should we supply the current duration too?  That value would change on
each call.   Seems redundant.

-- 
  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



^ permalink  raw  reply  [nested|flat] 20+ messages in thread

* Re: [SQL] Monitoring a Query
@ 2002-09-23 15:03  Tom Lane <tgl@sss.pgh.pa.us>
  parent: Bruce Momjian <pgman@candle.pha.pa.us>
  0 siblings, 1 reply; 20+ messages in thread

From: Tom Lane @ 2002-09-23 15:03 UTC (permalink / raw)
  To: Bruce Momjian <pgman@candle.pha.pa.us>; +Cc: Aaron Held <aaron@MetroNY.com>; Roberto Mello <rmello@cc.usu.edu>; Neil Conway <neilc@samurai.com>; pgsql-sql; pgsql-general@postgresql.org

Bruce Momjian <pgman@candle.pha.pa.us> writes:
> OK, added to TODO:
> 	* Add start time to pg_stat_activity

It would be nearly free to include the start time of the current
transaction, because we already save that for use by now().  Is
that good enough, or do we need start time of the current query?

			regards, tom lane



^ permalink  raw  reply  [nested|flat] 20+ messages in thread

* Re: [SQL] Monitoring a Query
@ 2002-09-23 15:06  Bruce Momjian <pgman@candle.pha.pa.us>
  parent: Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 20+ messages in thread

From: Bruce Momjian @ 2002-09-23 15:06 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: Aaron Held <aaron@MetroNY.com>; Roberto Mello <rmello@cc.usu.edu>; Neil Conway <neilc@samurai.com>; pgsql-sql; pgsql-general@postgresql.org

Tom Lane wrote:
> Bruce Momjian <pgman@candle.pha.pa.us> writes:
> > OK, added to TODO:
> > 	* Add start time to pg_stat_activity
> 
> It would be nearly free to include the start time of the current
> transaction, because we already save that for use by now().  Is
> that good enough, or do we need start time of the current query?

Current query, I am afraid.  We could optimize it so single-query
transactions wouldn't need to call that again.

-- 
  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



^ permalink  raw  reply  [nested|flat] 20+ messages in thread

* Re: [SQL] Monitoring a Query
@ 2002-09-23 17:01  Manfred Koizar <mkoi-pg@aon.at>
  parent: Bruce Momjian <pgman@candle.pha.pa.us>
  0 siblings, 1 reply; 20+ messages in thread

From: Manfred Koizar @ 2002-09-23 17:01 UTC (permalink / raw)
  To: Bruce Momjian <pgman@candle.pha.pa.us>; +Cc: Tom Lane <tgl@sss.pgh.pa.us>; Aaron Held <aaron@MetroNY.com>; Roberto Mello <rmello@cc.usu.edu>; Neil Conway <neilc@samurai.com>; pgsql-sql; pgsql-general@postgresql.org

On Mon, 23 Sep 2002 11:06:19 -0400 (EDT), Bruce Momjian
<pgman@candle.pha.pa.us> wrote:
>Tom Lane wrote:
>> It would be nearly free to include the start time of the current
>> transaction, because we already save that for use by now().  Is
>> that good enough, or do we need start time of the current query?
>
>Current query, I am afraid.  We could optimize it so single-query
>transactions wouldn't need to call that again.

This has been discussed before and I know I'm going to get flamed for
this, but IMHO having now() (which is a synonym for CURRENT_TIMESTAMP)
return the start time of the current transaction is a bug, or at least
it is not conforming to the standard.

SQL92 says in 6.8  <datetime value function>:

  General Rules

  1) The <datetime value function>s CURRENT_DATE, CURRENT_TIME, and
     CURRENT_TIMESTAMP respectively return the current date, current
     time, and current timestamp [...]
               ^^^^^^^

  3) If an SQL-statement generally contains more than one reference
               ^^^^^^^^^
     to one or more <datetime value function>s, then all such ref-
     erences are effectively evaluated simultaneously. The time of
     evaluation of the <datetime value function> during the execution
                                                 ^^^^^^
     of the SQL-statement is implementation-dependent.

SQL99 says in 6.19  <datetime value function>:

  3) Let S be an <SQL procedure statement> that is not generally
     contained in a <triggered action>. All <datetime value
     function>s that are generally contained, without an intervening
     <routine invocation> whose subject routines do not include an
     SQL function, in <value expression>s that are contained either
     in S without an intervening <SQL procedure statement> or in an
     <SQL procedure statement> contained in the <triggered action>
     of a trigger activated as a consequence of executing S, are
     effectively evaluated simultaneously. The time of evaluation of
     a <datetime value function> during the execution of S and its
     activated triggers is implementation-dependent.

I cannot say that I fully understand the second sentence (guess I have
to read it for another 100 times), but "during the execution of S"
seems to mean "not before the start and not after the end of S".

What do you think?

Servus
 Manfred



^ permalink  raw  reply  [nested|flat] 20+ messages in thread

* Re: [SQL] Monitoring a Query
@ 2002-09-23 17:05  Tom Lane <tgl@sss.pgh.pa.us>
  parent: Manfred Koizar <mkoi-pg@aon.at>
  0 siblings, 0 replies; 20+ messages in thread

From: Tom Lane @ 2002-09-23 17:05 UTC (permalink / raw)
  To: Manfred Koizar <mkoi-pg@aon.at>; +Cc: Bruce Momjian <pgman@candle.pha.pa.us>; Aaron Held <aaron@MetroNY.com>; Roberto Mello <rmello@cc.usu.edu>; Neil Conway <neilc@samurai.com>; pgsql-sql; pgsql-general@postgresql.org

Manfred Koizar <mkoi-pg@aon.at> writes:
> This has been discussed before and I know I'm going to get flamed for
> this, but IMHO having now() (which is a synonym for CURRENT_TIMESTAMP)
> return the start time of the current transaction is a bug, or at least
> it is not conforming to the standard.

As you say, it's been discussed before.  We concluded that the spec
defines the behavior as implementation-dependent, and therefore we
can pretty much do what we want.

If you want exact current time, there's always timeofday().

			regards, tom lane



^ permalink  raw  reply  [nested|flat] 20+ messages in thread

* Re: [GENERAL] Monitoring a Query
@ 2002-09-23 22:01  Roberto Mello <rmello@cc.usu.edu>
  parent: Bruce Momjian <pgman@candle.pha.pa.us>
  0 siblings, 1 reply; 20+ messages in thread

From: Roberto Mello @ 2002-09-23 22:01 UTC (permalink / raw)
  To: Bruce Momjian <pgman@candle.pha.pa.us>; +Cc: Neil Conway <neilc@samurai.com>; Aaron Held <aaron@MetroNY.com>; pgsql-sql; pgsql-general@postgresql.org

On Mon, Sep 23, 2002 at 10:48:30AM -0400, Bruce Momjian wrote:
> > > > 
> > > > Would it be a good idea to add the time that the current query began
> > > > execution at to pg_stat_activity?
> > > 
> > > What do people think about this?  It seems like a good idea to me.
> > 
> > OpenACS has a package called "Developer Support" that shows you (among
> > other things) how long a query took to be executed. Very good to finding 
> > out slow-running queries that need to be optimized.
> 
> 7.3 will have GUC 'log_duration' which will show query duration.

Forgive my ignorance here, but what is GUC? And how would I access the
query duration?

-Roberto

-- 
+----|        Roberto Mello   -    http://www.brasileiro.net/  |------+
+       Computer Science Graduate Student, Utah State University      +
+       USU Free Software & GNU/Linux Club - http://fslc.usu.edu/     +
Q:	What is purple and commutes?
A:	A boolean grape.



^ permalink  raw  reply  [nested|flat] 20+ messages in thread

* Re: [SQL] Monitoring a Query
@ 2002-09-24 00:27  Bruce Momjian <pgman@candle.pha.pa.us>
  parent: Roberto Mello <rmello@cc.usu.edu>
  0 siblings, 1 reply; 20+ messages in thread

From: Bruce Momjian @ 2002-09-24 00:27 UTC (permalink / raw)
  To: Roberto Mello <rmello@cc.usu.edu>; +Cc: Neil Conway <neilc@samurai.com>; Aaron Held <aaron@MetroNY.com>; pgsql-sql; pgsql-general@postgresql.org

Roberto Mello wrote:
> On Mon, Sep 23, 2002 at 10:48:30AM -0400, Bruce Momjian wrote:
> > > > > 
> > > > > Would it be a good idea to add the time that the current query began
> > > > > execution at to pg_stat_activity?
> > > > 
> > > > What do people think about this?  It seems like a good idea to me.
> > > 
> > > OpenACS has a package called "Developer Support" that shows you (among
> > > other things) how long a query took to be executed. Very good to finding 
> > > out slow-running queries that need to be optimized.
> > 
> > 7.3 will have GUC 'log_duration' which will show query duration.
> 
> Forgive my ignorance here, but what is GUC? And how would I access the
> query duration?

GUC is postgresql.conf and SET commands.  They are variables that can be
set.

-- 
  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



^ permalink  raw  reply  [nested|flat] 20+ messages in thread

* Re: [SQL] Monitoring a Query
@ 2002-09-24 02:11  Alvaro Herrera <alvherre@atentus.com>
  parent: Bruce Momjian <pgman@candle.pha.pa.us>
  0 siblings, 1 reply; 20+ messages in thread

From: Alvaro Herrera @ 2002-09-24 02:11 UTC (permalink / raw)
  To: Bruce Momjian <pgman@candle.pha.pa.us>; +Cc: Roberto Mello <rmello@cc.usu.edu>; pgsql-sql; pgsql-general@postgresql.org

Bruce Momjian dijo: 

> Roberto Mello wrote:

> > Forgive my ignorance here, but what is GUC? And how would I access the
> > query duration?
> 
> GUC is postgresql.conf and SET commands.  They are variables that can be
> set.

Just for the record, GUC is an acronym for "Grand Unified
Configuration".

-- 
Alvaro Herrera (<alvherre[a]atentus.com>)
"El hombre nunca sabe de lo que es capaz hasta que lo intenta" (C. Dickens)




^ permalink  raw  reply  [nested|flat] 20+ messages in thread

* Re: [SQL] Monitoring a Query
@ 2002-09-24 03:18  Bruce Momjian <pgman@candle.pha.pa.us>
  parent: Alvaro Herrera <alvherre@atentus.com>
  0 siblings, 0 replies; 20+ messages in thread

From: Bruce Momjian @ 2002-09-24 03:18 UTC (permalink / raw)
  To: Alvaro Herrera <alvherre@atentus.com>; +Cc: Roberto Mello <rmello@cc.usu.edu>; pgsql-sql; pgsql-general@postgresql.org

Alvaro Herrera wrote:
> Bruce Momjian dijo: 
> 
> > Roberto Mello wrote:
> 
> > > Forgive my ignorance here, but what is GUC? And how would I access the
> > > query duration?
> > 
> > GUC is postgresql.conf and SET commands.  They are variables that can be
> > set.
> 
> Just for the record, GUC is an acronym for "Grand Unified
> Configuration".

Thanks.  I couldn't remember that.

-- 
  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



^ permalink  raw  reply  [nested|flat] 20+ messages in thread


end of thread, other threads:[~2002-09-24 03:18 UTC | newest]

Thread overview: 20+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2002-09-20 15:34 Monitoring a Query Aaron Held <aaron@MetroNY.com>
2002-09-20 16:18 ` Bruce Momjian <pgman@candle.pha.pa.us>
2002-09-20 16:19 ` Bruce Momjian <pgman@candle.pha.pa.us>
2002-09-20 19:54   ` Neil Conway <neilc@samurai.com>
2002-09-23 01:51     ` Bruce Momjian <pgman@candle.pha.pa.us>
2002-09-23 13:24       ` Aaron Held <aaron@MetroNY.com>
2002-09-23 13:47       ` Roberto Mello <rmello@cc.usu.edu>
2002-09-23 14:31         ` Aaron Held <aaron@MetroNY.com>
2002-09-23 14:49           ` Bruce Momjian <pgman@candle.pha.pa.us>
2002-09-23 15:03             ` Tom Lane <tgl@sss.pgh.pa.us>
2002-09-23 15:06               ` Bruce Momjian <pgman@candle.pha.pa.us>
2002-09-23 17:01                 ` Manfred Koizar <mkoi-pg@aon.at>
2002-09-23 17:05                   ` Tom Lane <tgl@sss.pgh.pa.us>
2002-09-23 14:48         ` Bruce Momjian <pgman@candle.pha.pa.us>
2002-09-23 22:01           ` Roberto Mello <rmello@cc.usu.edu>
2002-09-24 00:27             ` Bruce Momjian <pgman@candle.pha.pa.us>
2002-09-24 02:11               ` Alvaro Herrera <alvherre@atentus.com>
2002-09-24 03:18                 ` Bruce Momjian <pgman@candle.pha.pa.us>
2002-09-20 18:56 ` Bruce Momjian <pgman@candle.pha.pa.us>
2002-09-20 19:13 ` Aaron Held <aaron@MetroNY.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox