Re: wrong rows estimation by hash join

Поиск
Список
Период
Сортировка
От Tomas Vondra
Тема Re: wrong rows estimation by hash join
Дата
Msg-id 8f79dacb-332e-7bde-e9e9-1a2319aa51f4@enterprisedb.com
обсуждение исходный текст
Ответ на wrong rows estimation by hash join  ("James Pang (chaolpan)" <chaolpan@cisco.com>)
Список pgsql-performance
Hi,

On 6/9/23 10:36, James Pang (chaolpan) wrote:
>   How does hash join estimation rows ?   pg v14, it make wrong rows
> estimation then leave nest loop lef join that make poor sql plan.  A
> 

I doubt this is specific to hashjoins, we estimate cardinality the same
way for all joins (or more precisely, we estimate it before picking the
particular join method).

I'm just guessing, but I'd bet the join condition is correlated with the
filter on cs_contract:

> ->  Index
> Scan using cs_xxxx_test on cs_contract cc  (cost=0.43..167540.92
> rows=237989 width=115)
> Index Cond: ((xx_to > CURRENT_DATE) AND ((status)::text = ANY
> ('{Active,Inactive,Pending}'::text[])))
> 

If you remove that condition, does the estimate improve?


regards

-- 
Tomas Vondra
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company



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

Предыдущее
От: "James Pang (chaolpan)"
Дата:
Сообщение: wrong rows estimation by hash join
Следующее
От: "James Pang (chaolpan)"
Дата:
Сообщение: Postgresql equal join on function with columns not use index