Re: different execution times of the same query

From: Luca Ferrari <fluca1978(at)infinito(dot)it>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: different execution times of the same query
Date: 2009-10-20 10:51:55
Message-ID: 200910201251.55496.fluca1978@infinito.it
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Craig Ringer 2009-10-20 10:52:37 Re: 答复: [GENERAL] About could not connect to server: Connection timed out
Previous Message Grzegorz Jaśkiewicz 2009-10-20 10:44:43 Re: Free Tool to design Postgres Databases