Re: Query that does not use indexes

Поиск
Список
Период
Сортировка
От Ragnar
Тема Re: Query that does not use indexes
Дата
Msg-id 1175076702.1153.80.camel@localhost.localdomain
обсуждение исходный текст
Ответ на Query that does not use indexes  (Denis Gasparin <denis@edistar.com>)
Список pgsql-general
On þri, 2007-03-27 at 12:54 +0200, Denis Gasparin wrote:
> I have a query that performs a multiple join between four tables and
> that doesn't use the defined indexes.

> If I set enable_seqscan to off, the query obviously uses the indexes and
> it is considerable faster than normal planned execution with
> enable_seqscan=true.


a few things you might try:
fiddle with random_page_cost
make sure effective_cache_size is set to a realistic value
increase statistics target on critical columns, like
  ORDER.ORDER_DATE and join columns
 (and re-analyze)

possibly get change the cast in your where clause:
  ORDER.ORDER_DATE::date between '2007-03-01' and '2007-03-27'
to
  ORDER.ORDER_DATE between '2007-03-01'::timestamp
                   and '2007-03-27'::timestamp


gnari




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

Предыдущее
От: Peter Eisentraut
Дата:
Сообщение: Re: redhat debug info
Следующее
От: Stephane Bortzmeyer
Дата:
Сообщение: [ANNOUNCE] echoping 6, with a PostgreSQL plugin