Planner improvement suggestion
| От | Ilia Kantor |
|---|---|
| Тема | Planner improvement suggestion |
| Дата | |
| Msg-id | auto-000558493797@umail.ru обсуждение исходный текст |
| Ответы |
Re: Planner improvement suggestion
|
| Список | pgsql-performance |
I have a query:
SELECT oh.idFROM objects_hier ohwhereoh.id < 2000 (!)andoh.id in ( SELECT id as id FROM objects_access oa WHERE oa.master IN (1,2,10001) AND oa.id < 2000 (!))
The sense of the query is simple: I choose ids from objects_hier where access has necessary masters.
The problem is: I have duplicate conditions for id here. They are marked with ‘!’.
I just can’t remove any of them, because planner needs to estimate both outer and inner selects to calculate the order
Of nested loop or choose a join. If I remove one of duplicate conditions – planner can’t estimate well.
It’s obvious that condition on oh.id can be put inside or outside “oh.id in ( .. )” statement with same result.
So I just suggest that the planner should take this into account and “propagate” the condition outside or inside for planning if needed.
P.S
Is there a way to fix this particular query? Usually oh.id condition is not like <2000, but an inner join.
В списке pgsql-performance по дате отправления: