Re: a wrong index choose when statistics is out of date - Mailing list pgsql-hackers

From Andy Fan
Subject Re: a wrong index choose when statistics is out of date
Date
Msg-id 87jzm68tjv.fsf@163.com
Whole thread Raw
In response to Re: a wrong index choose when statistics is out of date  (Andrei Lepikhov <a.lepikhov@postgrespro.ru>)
List pgsql-hackers
>
> Having had the same problem for a long time, I've made an attempt and
> invented a patch that probes an index to determine whether the estimated
> constant is within statistics' scope.
> I remember David's remark on the overhead problem, but I don't argue it
> here. This patch is on the table to have one more solution sketch for
> further discussion.

I think the following code will be really horrendous on peformance
aspect, think about the cases where we have thousands of tuples.

+        index_rescan(index_scan, scankeys, 1, NULL, 0);
+        while (index_getnext_tid(index_scan, ForwardScanDirection) != NULL)
+        {
+            ntuples++;
+        }
+

> Also, Andy, if you have a specific problem with index choosing, you can
> try a tiny option that makes the index-picking technique less dependent
> on the ordering of index lists [1].

thanks, index choosing issue already not the only issue I want to address now.

You said the my patch was kind of lucky to work at [1], have you figure
out an example to prove that?

[1]
https://www.postgresql.org/message-id/701d2097-2c5b-41e2-8629-734e3c8ba613%40postgrespro.ru 

-- 
Best Regards
Andy Fan




pgsql-hackers by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: meson: Specify -Wformat as a common warning flag for extensions
Next
From: Peter Eisentraut
Date:
Subject: Re: meson vs tarballs