pg.ddx.io pgsql-performance@postgresql.org mailing list archive
help / color / mirror / Atom feedquery total time im milliseconds
8+ messages / 3 participants
[nested] [flat]
* query total time im milliseconds
@ 2011-07-10 11:41 Radhya sahal <rad_cs_2006@yahoo.com>
0 siblings, 1 reply; 8+ messages in thread
From: Radhya sahal @ 2011-07-10 11:41 UTC (permalink / raw)
To: pgsql-performance
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 retentive the query total time
in millisecond
if i connect with postgresql from java using JDBC
i need the query total time necessaryto use it in my project
i don't want run explian just query
thank's
^ permalink raw reply [nested|flat] 8+ messages in thread
* query total time im milliseconds
@ 2011-07-10 13:07 Radhya sahal <rad_cs_2006@yahoo.com>
0 siblings, 0 replies; 8+ messages in thread
From: Radhya sahal @ 2011-07-10 13:07 UTC (permalink / raw)
To: pgsql-performance
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 thim for the query
thank's
^ permalink raw reply [nested|flat] 8+ messages in thread
* query total time im milliseconds
@ 2011-07-10 13:08 Radhya sahal <rad_cs_2006@yahoo.com>
0 siblings, 1 reply; 8+ messages in thread
From: Radhya sahal @ 2011-07-10 13:08 UTC (permalink / raw)
To: pgsql-performance
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
thank's
^ permalink raw reply [nested|flat] 8+ messages in thread
* query total time im milliseconds
@ 2011-07-10 16:44 Radhya sahal <rad_cs_2006@yahoo.com>
0 siblings, 0 replies; 8+ messages in thread
From: Radhya sahal @ 2011-07-10 16:44 UTC (permalink / raw)
To: pgsql-performance
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
thank's
^ permalink raw reply [nested|flat] 8+ messages in thread
* Re: query total time im milliseconds
@ 2011-07-10 17:51 Samuel Gendler <sgendler@ideasculptor.com>
parent: Radhya sahal <rad_cs_2006@yahoo.com>
0 siblings, 1 reply; 8+ messages in thread
From: Samuel Gendler @ 2011-07-10 17:51 UTC (permalink / raw)
To: Radhya sahal <rad_cs_2006@yahoo.com>; +Cc: pgsql-performance
On Sun, Jul 10, 2011 at 4:41 AM, Radhya sahal <rad_cs_2006@yahoo.com> 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 retentive the query total time
> in millisecond
> if i connect with postgresql from java using JDBC
> i need the query total time necessaryto use it in my project
> i don't want run explian just query
> thank's
>
long startTime = System.currentTimeMillis();
//execute query
long executionTime = System.currentTimeMillis() - startTime;
^ permalink raw reply [nested|flat] 8+ messages in thread
* Fw: query total time im milliseconds
@ 2011-07-10 18:26 Radhya sahal <rad_cs_2006@yahoo.com>
parent: Samuel Gendler <sgendler@ideasculptor.com>
0 siblings, 1 reply; 8+ messages in thread
From: Radhya sahal @ 2011-07-10 18:26 UTC (permalink / raw)
To: pgsql-performance
----- Forwarded Message ----
From: Radhya sahal <rad_cs_2006@yahoo.com>
To: Samuel Gendler <sgendler@ideasculptor.com>
Sent: Sun, July 10, 2011 11:25:46 AM
Subject: Re: [PERFORM] query total time im milliseconds
Thank's
long startTime = System.currentTimeMillis();
//execute query
long executionTime = System.currentTimeMillis() - startTime;
this executionTime is not an actual time for query ,
it includes time for access to postgresql server
using JDBC
________________________________
From: Samuel Gendler <sgendler@ideasculptor.com>
To: Radhya sahal <rad_cs_2006@yahoo.com>
Cc: pgsql-performance group <pgsql-performance@postgresql.org>
Sent: Sun, July 10, 2011 10:51:52 AM
Subject: Re: [PERFORM] query total time im milliseconds
On Sun, Jul 10, 2011 at 4:41 AM, Radhya sahal <rad_cs_2006@yahoo.com> 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 retentive the query total time
>in millisecond
>
>if i connect with postgresql from java using JDBC
>i need the query total time necessaryto use it in my project
>i don't want run explian just query
>thank's
long startTime = System.currentTimeMillis();
//execute query
long executionTime = System.currentTimeMillis() - startTime;
^ permalink raw reply [nested|flat] 8+ messages in thread
* Re: query total time im milliseconds
@ 2011-07-10 22:20 Craig Ringer <craig@postnewspapers.com.au>
parent: Radhya sahal <rad_cs_2006@yahoo.com>
0 siblings, 0 replies; 8+ messages in thread
From: Craig Ringer @ 2011-07-10 22:20 UTC (permalink / raw)
To: Radhya sahal <rad_cs_2006@yahoo.com>; +Cc: 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/
^ permalink raw reply [nested|flat] 8+ messages in thread
* Re: Fw: query total time im milliseconds
@ 2011-07-10 22:54 Craig Ringer <craig@postnewspapers.com.au>
parent: Radhya sahal <rad_cs_2006@yahoo.com>
0 siblings, 0 replies; 8+ messages in thread
From: Craig Ringer @ 2011-07-10 22:54 UTC (permalink / raw)
To: pgsql-performance
On 11/07/2011 2:26 AM, Radhya sahal wrote:
> long startTime = System.currentTimeMillis();
> //execute query
> long executionTime = System.currentTimeMillis() - startTime;
>
> this executionTime is not an actual time for query ,
> it includes time for access to postgresql server
> using JDBC
The pg_stat_statements contrib module in PostgreSQL 8.4 and above might
be able to do what you want. See the documentation here:
http://www.postgresql.org/docs/9.0/static/pgstatstatements.html
I don't think the core PostgreSQL server currently retains information
about how long the last query executed ran for. I thought the PL/PgSQL
"GET DIAGNOSTICS" statement might be able to find out how long the last
query run within that PL/PgSQL function took, but it can't. So I think
you're out of luck for now.
PostgreSQL *CAN* log query durations to the server log, it just doesn't
(AFAIK) offer any way to find out how long the last query took from SQL
and doesn't keep that information after the statement finishes.
--
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/
^ permalink raw reply [nested|flat] 8+ messages in thread
end of thread, other threads:[~2011-07-10 22:54 UTC | newest]
Thread overview: 8+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2011-07-10 11:41 query total time im milliseconds Radhya sahal <rad_cs_2006@yahoo.com>
2011-07-10 17:51 ` Samuel Gendler <sgendler@ideasculptor.com>
2011-07-10 18:26 ` Radhya sahal <rad_cs_2006@yahoo.com>
2011-07-10 22:54 ` Craig Ringer <craig@postnewspapers.com.au>
2011-07-10 13:07 query total time im milliseconds Radhya sahal <rad_cs_2006@yahoo.com>
2011-07-10 13:08 query total time im milliseconds Radhya sahal <rad_cs_2006@yahoo.com>
2011-07-10 22:20 ` Craig Ringer <craig@postnewspapers.com.au>
2011-07-10 16:44 query total time im milliseconds Radhya sahal <rad_cs_2006@yahoo.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