Re: wrong rows estimation by hash join

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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





[Postgresql General]     [Postgresql PHP]     [PHP Users]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Yosemite]

  Powered by Linux