Re: query planner not using index, instead using squential scan
От | Tom Lane |
---|---|
Тема | Re: query planner not using index, instead using squential scan |
Дата | |
Msg-id | 560773.1622921370@sss.pgh.pa.us обсуждение исходный текст |
Ответ на | query planner not using index, instead using squential scan (Ayub Khan <ayub.hp@gmail.com>) |
Ответы |
Re: query planner not using index, instead using squential scan
|
Список | pgsql-performance |
Ayub Khan <ayub.hp@gmail.com> writes: > could someone clarify why the LEFT JOIN order_offer_map oom using > (order_id) in the below query is using sequential scan instead of > using index on order_id which is defined in order_offer_map table. Probably because it estimates the hash join to restaurant_order is faster than a nestloop join would be. I think it's likely right. You'd need very optimistic assumptions about the cost of an individual index probe into order_offer_map to conclude that 156K of them would be faster than the 476ms that are being spent here to read order_offer_map and join it to the result of the indexscan on restaurant_order. If, indeed, that *is* faster on your hardware, you might want to dial down random_page_cost to get more-relevant estimates. regards, tom lane
В списке pgsql-performance по дате отправления: