Re: Query with multiples operators BETWEEN

Поиск
Список
Период
Сортировка
От Renaud Tthonnart
Тема Re: Query with multiples operators BETWEEN
Дата
Msg-id 3A96300E.E8BB5529@amwdb.u-strasbg.fr
обсуждение исходный текст
Ответ на Location of 7.1 version for download  ("Paulo Parola" <pgsql@brazilinfo.com>)
Список pgsql-general
Tom Lane wrote:

>
> Do a VACUUM ANALYZE, for starters.  These results look like the planner
> is working with the initial default estimates for a never-vacuumed table.
>
>
> Indexes might be a good idea too.
> http://www.postgresql.org/devel-corner/docs/postgres/indices.html
> has a good intro to the basics.
>
>                         regards, tom lane

The qwery  I have problem with is always :

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;

EXPLAIN result is :

NOTICE:  QUERY PLAN:

Nested Loop  (cost=0.00..56.67 rows=3 width=20)
  ->  Seq Scan on observation o  (cost=0.00..30.00 rows=1 width=4)
  ->  Seq Scan on exposure_epic e  (cost=0.00..22.50 rows=333 width=16)

EXPLAIN


I have created an index on columns ra and de :
    CREATE INDEX ra_de_ind ON observation(ra,de);
    CLUSTER ra_de_ind ON observation;
    VACUUM observation;


EXPLAIN result becomes :

Nested Loop  (cost=0.00..28.69 rows=3 width=20)
  ->  Index Scan using ra_de_ind on observation o  (cost=0.00..2.03 rows=1
width=4)
  ->  Seq Scan on exposure_epic e  (cost=0.00..22.50 rows=333 width=16)


But the qwery is always not able to find what I'm looking for.

Renaud THONNART






В списке pgsql-general по дате отправления:

Предыдущее
От: Louis-David Mitterrand
Дата:
Сообщение: UNIQUE constraint fails
Следующее
От: Karel Zak
Дата:
Сообщение: Re: International support