timing queries?

Started by Andy Krigerover 23 years ago4 messagesgeneral
Jump to latest
#1Andy Kriger
akriger@greaterthanone.com

Is it possible to find out how long a query takes in the psql command-line
tool? For example, when I exectute a query I want to see 28ms or whatever
before the query results. If not in the command-line tool, is there a way to
log this info? (I have query logging turned on, but that just shows the
query being executed). I need this info to compare against making calls
through JDBC and through an object-layer on top of JDBC.

thx
andy

#2Nicolai Tufar
ntufar@apb.com.tr
In reply to: Andy Kriger (#1)
Re: timing queries?

EXPLAIN ANALYZE <your query here>

----- Original Message -----
From: "Andy Kriger" <akriger@greaterthanone.com>
To: "Pgsql-General" <pgsql-general@postgresql.org>
Sent: Monday, December 02, 2002 8:05 PM
Subject: [GENERAL] timing queries?

Is it possible to find out how long a query takes in the psql command-line
tool? For example, when I exectute a query I want to see 28ms or whatever
before the query results. If not in the command-line tool, is there a way

to

Show quoted text

log this info? (I have query logging turned on, but that just shows the
query being executed). I need this info to compare against making calls
through JDBC and through an object-layer on top of JDBC.

thx
andy

---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org

#3Bruce Momjian
bruce@momjian.us
In reply to: Andy Kriger (#1)
Re: timing queries?

In 7.3, you can use \timing to see query duration, or SET log_duration
TO 'on';SET client_min_messages TO 'log'.

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

Andy Kriger wrote:

Is it possible to find out how long a query takes in the psql command-line
tool? For example, when I exectute a query I want to see 28ms or whatever
before the query results. If not in the command-line tool, is there a way to
log this info? (I have query logging turned on, but that just shows the
query being executed). I need this info to compare against making calls
through JDBC and through an object-layer on top of JDBC.

thx
andy

---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go 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
#4P.J. "Josh" Rovero
rovero@sonalysts.com
In reply to: Andy Kriger (#1)
Re: timing queries?

In 7.3 psql, just issue (at the psql prompt):

\timing

All queries subsequent to the command will have timing info.

\timing

again to toggle it off.

Andy Kriger wrote:

Is it possible to find out how long a query takes in the psql command-line
tool? For example, when I exectute a query I want to see 28ms or whatever
before the query results. If not in the command-line tool, is there a way to
log this info? (I have query logging turned on, but that just shows the
query being executed). I need this info to compare against making calls
through JDBC and through an object-layer on top of JDBC.

thx
andy

---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org

--
P. J. "Josh" Rovero Sonalysts, Inc.
Email: rovero@sonalysts.com www.sonalysts.com 215 Parkway North
Work: (860)326-3671 or 442-4355 Waterford CT 06385
***********************************************************************