Re: query total time im milliseconds

From: Craig Ringer <craig(at)postnewspapers(dot)com(dot)au>
To: Radhya sahal <rad_cs_2006(at)yahoo(dot)com>
Cc: pgsql-performance group <pgsql-performance(at)postgresql(dot)org>
Subject: Re: query total time im milliseconds
Date: 2011-07-10 22:20:45
Message-ID: 4E1A25BD.2080905@postnewspapers.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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/

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Craig Ringer 2011-07-10 22:54:00 Re: Fw: query total time im milliseconds
Previous Message Samuel Gendler 2011-07-10 21:31:25 Re: Statistics and Multi-Column indexes