Re: [SQL] SQL query _slow_

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: [SQL] SQL query _slow_
Дата
Msg-id 8710.919698179@sss.pgh.pa.us
обсуждение исходный текст
Список pgsql-sql
Bruce Momjian <maillist@candle.pha.pa.us> writes:
> Gregg Berkholtz <gregg@gbcomputers.com> writes:
>> Would indexes help at all? <-- If so, what should I index to get the best
>> speed?

> Not sure.  If EXPLAIN is slow showing results, it is just the optimizer.

Assuming Bruce has correctly diagnosed the problem (I think he has),
adding indexes would make things *worse* in 6.4.*, because it'd increase
the number of cases the optimizer has to consider.

Bruce fixed several bugs in the optimizer that were causing it to
consider far more combinations than it should in queries that join a
lot of tables.  So your query should work OK in 6.5, and at that point
you should try adding indexes to improve the speed of the actual query
(as opposed to the planning stage).

As a stopgap measure while you're using 6.4.*, try setting the GEQO
threshold to less than 7 tables.

            regards, tom lane

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: HAVING confusion..
Следующее
От: "jose' soares"
Дата:
Сообщение: Re: [SQL] SQL-Query 2 get primary key