| From: | Jean-Christophe ARNU (JX) <jc(dot)arnu(at)free(dot)fr> |
|---|---|
| To: | pgsql-admin(at)postgresql(dot)org |
| Subject: | Timestamps and performances problems |
| Date: | 2002-04-10 08:55:17 |
| Message-ID: | 20020410045517.57c89e27.jc.arnu@free.fr |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-admin |
Hello all.
I've a performance problem on specific requests :
When I use timestamps + interval in where clauses, query performance is
slowed down by a factor of 20 or 30!!!! For exemple :
select timestamp,value
from measure
where timestamp<now() and timestamp>(now() - '1 hour'::interval)
is 20 to 30 times longer than
select timestamp,value
from measure
where timestamp<'2002-04-10 10:00' and timestamp>='2002-04-10 9:00';
So where is the bottleneck?
A paradigm seems that now() and (now() - '1hour'::interval) is evaluated for
each row comparison... Am I right? Thus is there a way to make SQL
interpreter evaluate this by rewriting them before launching any comparisons?
Or do I have to rewrite all my application queries and calculate each time
now() and interval predicates?
Thanks by advance
--
Jean-Christophe ARNU
s/w developer
Paratronic France
MR: J'ai beaucoup entendu parler de fcol, mais je n'y suis jamais alle
MR: jeter un oeil.... c'est quoi l'adresse ?
CL: Tu viens d'y poster :)
-+- in Guide de linuxien pervers : "Termes abscons..." -+-
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Gaetano Mendola | 2002-04-10 09:51:28 | Re: Timestamps and performances problems |
| Previous Message | Jean-Christophe ARNU (JX) | 2002-04-10 08:22:15 | Timestamps and performances problems |