Re: different execution times of the same query - Mailing list pgsql-general

From Luca Ferrari
Subject Re: different execution times of the same query
Date
Msg-id 200910201251.55496.fluca1978@infinito.it
Whole thread Raw
In response to Re: different execution times of the same query  (Scott Marlowe <scott.marlowe@gmail.com>)
Responses Re: different execution times of the same query
List pgsql-general
On Tuesday 20 October 2009 10:44:13 am Scott Marlowe's cat walking on the
keyboard wrote:
> Two things.  1: Actually running the query and receiving the results
> isn't the same as just running it and throwing them away (what explain
> analyze does) and 2: The query may be getting cached in psql if you're
> running it more than once, but it may not run often enough on that
> data set to get the same caching each time.
>


You are right, in fact executing:

psql -h localhost -U dataflex cogedb -c "SELECT *  FROM GMMOVART  WHERE DATA
>= '01/01/2006' AND DATA  <= '31/12/2006' ORDER BY DATA, CONTATORE, RIGA" -o
/dev/null

produces a log like the following:

cogedb LOG:  duration: 8841.152 ms  statement: SELECT *  FROM GMMOVART  WHERE
DATA  >= '01/01/2006' AND DATA  <= '31/12/2006' ORDER BY DATA, CONTATORE, RIGA

so 8,8 seconds against 7 seconds, now it sounds compatible. But I was always
trusting the time of explain analyze, this make me doubt about it. So how is
such time (explain analyze) to mind?

Luca

pgsql-general by date:

Previous
From: Grzegorz Jaśkiewicz
Date:
Subject: Re: Free Tool to design Postgres Databases
Next
From: Craig Ringer
Date:
Subject: Re: 答复: [GENERAL] About could not connect to server: Connection timed out