On 10/6/21 23:03, Zhihong Yu wrote:
Hi,
+ conditions2 = statext_determine_join_restrictions(root, rel, mcv);
+
+ /* if the new statistics covers more conditions, use it */
+ if (list_length(conditions2) > list_length(conditions1))
+ {
+ mcv = stat;
It seems conditions2 is calculated using mcv, I wonder why mcv is
replaced by stat (for conditions1 whose length is shorter) ?
Yeah, that's wrong - it should be the other way around, i.e.
if (list_length(conditions1) > list_length(conditions2))
There's no test with multiple candidate statistics yet, so this went
unnoticed :-/
regards
--
Tomas Vondra
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company