Query with multiples operators BETWEEN - Mailing list pgsql-general

From Renaud Tthonnart
Subject Query with multiples operators BETWEEN
Date
Msg-id 3A953A0B.14D004@amwdb.u-strasbg.fr
Whole thread Raw
In response to Location of 7.1 version for download  ("Paulo Parola" <pgsql@brazilinfo.com>)
Responses Re: Query with multiples operators BETWEEN  (Neil Conway <nconway@klamath.dyndns.org>)
List pgsql-general
This qwery takes about 2 seconds :

SELECT e.name
FROM Observation o, Exposure_EPIC e
WHERE o.numObs = e.obs
  AND e.instrPN IS NOT NULL
  AND o.RA BETWEEN 3 AND 5;

This one about 5 seconds :

SELECT e.name
FROM Observation o, Exposure_EPIC e
WHERE o.numObs = e.obs
  AND e.instrPN IS NOT NULL
  AND o.DE BETWEEN 2 AND 7;

And this takes a lot of time!!!! (I can't say how much because I 've
always given it up before its end,
                                                             at least
more than 10 minutes)

SELECT e.name
FROM Observation o, Exposure_EPIC e
WHERE o.numObs = e.obs
  AND e.instrPN IS NOT NULL
  AND o.RA BETWEEN 3 AND 5
  AND o.DE BETWEEN 2 AND 7;

Could someone help or explain me?

Thanks in advance and excuse my bad English
Renaud THONNART


pgsql-general by date:

Previous
From: Louis-David Mitterrand
Date:
Subject: iterating over all NEW.* values in a trigger?
Next
From: Neil Conway
Date:
Subject: Re: Query with multiples operators BETWEEN