From: Craig Ringer <craig@postnewspapers.com.au>
To: Radhya sahal <rad_cs_2006@yahoo.com>
Cc: pgsql-performance group <pgsql-performance@postgresql.org>
Subject: Re: query total time im milliseconds
Date: Mon, 11 Jul 2011 06:20:45 +0800
Message-ID: <4E1A25BD.2080905@postnewspapers.com.au> (raw)
In-Reply-To: <1310303281.47662.YahooMailRC@web38607.mail.mud.yahoo.com>
References: <1310303281.47662.YahooMailRC@web38607.mail.mud.yahoo.com>
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/
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-performance@postgresql.org
Cc: craig@postnewspapers.com.au, rad_cs_2006@yahoo.com
Subject: Re: query total time im milliseconds
In-Reply-To: <4E1A25BD.2080905@postnewspapers.com.au>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
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