How to get the used time when operate a select query?

Поиск
Список
Период
Сортировка
Искать

How to get the used time when operate a select query?

От:
黄春茂 <huang@tanpopo-tane.com>
Дата:
How can I  get the time which a select query use?
thank you!




Re: How to get the used time when operate a select query?

От:
Oskar Berggren <beo@sgs.o.se>
Дата:
$B2+=ULP wrote:
> How can I  get the time which a select query use?
> thank you!
> 
> 

If you are using version 7.2 or later, try the command

EXPLAIN ANALYZE 

This will perform the query (even if it is a DELETE FROM !)
and show the actual time.

/Oskar

Ps. You should check what your mail client puts in the from field
of you mail. It is quite unreadable...

-- 
/----------------------------------------------------------------------\
| Oskar Berggren        beo@sgs.o.se                                   |
| Network and Software Engineer                     SGS Datanätgrupp   |
|                                                   Gothenburg, Sweden |
\----------------------------------------------------------------------/



Re: How to get the used time when operate a select query?

От:
nconway@klamath.dyndns.org (Neil Conway)
Дата:
On Thu, Jun 27, 2002 at 12:01:09PM +0200, Oskar Berggren wrote:
> $B2+=ULP wrote:
> >How can I  get the time which a select query use?
> >thank you!
> 
> If you are using version 7.2 or later, try the command
> 
> EXPLAIN ANALYZE 
> 
> This will perform the query (even if it is a DELETE FROM !)
> and show the actual time.

BTW in 7.3, you'll be able to do "\timing" inside psql to enable
client-side timing. i.e.

nconway=# \timing
Timing is on.
nconway=# select 1;
 ?column? 
 ----------
         1
(1 row)

Total time: 0.001s
nconway=#

Cheers,

Neil

-- 
Neil Conway 
PGP Key ID: DB3C29FC


Re: How to get the used time when operate a select query?

От:
Tom Lane <tgl@sss.pgh.pa.us>
Дата:
nconway@klamath.dyndns.org (Neil Conway) writes:
> BTW in 7.3, you'll be able to do "\timing" inside psql to enable
> client-side timing. i.e.

> nconway=# select 1;
>  ?column? 
>  ----------
>          1
> (1 row)

> Total time: 0.001s

Why is the precision of the display restricted to milliseconds?
Clock readings are usually good to a few microseconds on modern
machines.

I'd suggest showing the result in the same format used by EXPLAIN
ANALYZE, which is milliseconds with a fractional part.

			regards, tom lane


FAQ