Re: [SQL] SQL query _slow_
Re: [SQL] SQL query _slow_
От:
Tom Lane <tgl@sss.pgh.pa.us>
Дата:
Bruce Momjian writes: > Gregg Berkholtz 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