Re: query total time im milliseconds - Mailing list pgsql-performance

From Craig Ringer
Subject Re: query total time im milliseconds
Date
Msg-id 4E1A25BD.2080905@postnewspapers.com.au
Whole thread Raw
In response to query total time im milliseconds  (Radhya sahal <rad_cs_2006@yahoo.com>)
List pgsql-performance
On 10/07/2011 9:08 PM, Radhya sahal wrote:
>
> Dear all ,
> could any one help me?
> when i use pgadmin to exceute a query it shows the total time for query ..
> such as
> (select * form table_name.........)query total time is for example 100 ms
> i want to know the command that can retetive the query total time in
> millisecond
> if i connect with postgresql from java using JDBC
> i need the query total time necessary to use it in my project
> i don't want run explian,explain gives estimated i want real total time
> for the query

Record the value of System.currentTimeMillis() or System.nanoTime(). Run
your query. Subtract the recorded value from the current value of
System.currentTimeMillis() or System.nanoTime() to get the execution
time including how long the query took to transfer data from the server
to your client.

I'm not aware of a way to find out how long the query took to execute on
the server - excluding data transfer to the client - without using
EXPLAIN ANALYZE.

--
Craig Ringer

POST Newspapers
276 Onslow Rd, Shenton Park
Ph: 08 9381 3088     Fax: 08 9388 2258
ABN: 50 008 917 717
http://www.postnewspapers.com.au/

pgsql-performance by date:

Previous
From: Samuel Gendler
Date:
Subject: Re: Statistics and Multi-Column indexes
Next
From: Craig Ringer
Date:
Subject: Re: Fw: query total time im milliseconds