![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Hi Andrew, I posted for another post, its may give you a workaround. I still not fully understand how PG choose execute plan that slow down so much. I had the same situation in one of my query. Use the subquery can speed up almost by 100 times faster. .......... |
|
Hope this help. Best Regards, Alex Lai -- Best regards, Alex Lai OMI SIPS DBA ADNET Systems , Inc. 7515 Mission Drive, Suite A100 Lanham, MD 20706 301-352-4657 (phone) 301-352-0437 (fax) alai (AT) sesda2 (DOT) com |
#3
| |||
| |||
|
|
In my specific case, what I've seen from the query execution plans, is that without LIMIT the query uses Hash Joins, but once I add LIMIT, it starts using Nested Loop Joins almost everywhere. |
#4
| |||
| |||
|
|
Andrew Schetinin <aschetinin (AT) gmail (DOT) com> writes: In my specific case, what I've seen from the query execution plans, is that without LIMIT the query uses Hash Joins, but once I add LIMIT, it starts using Nested Loop Joins almost everywhere. Usually, that's an appropriate change for a small LIMIT. It's certainly not a priori evidence of a planner bug. If you want useful comments about this, please review http://wiki.postgresql.org/wiki/Slow_Query_Questions about how to provide an adequate description of your problem. regards, tom lane |
#5
| |||
| |||
|
|
Previously I always thought that the order of JOINs or conditions in WHERE is irrelevant, and query optimizer rearranges the order according to its logic. Now it appears that sometimes it may be important. |
![]() |
| Thread Tools | |
| Display Modes | |
| |