forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commitca5f885
committed
Improve eqjoinsel_semi's behavior for small inner relations with no stats.
If we don't have any MCV statistics for the inner relation, and we don'ttrust its numdistinct estimate either, eqjoinsel_semi falls back to a veryconservative estimate (that 50% of the outer rows have matches). This isparticularly problematic if the inner relation is completely empty, sincethen even an explicit ANALYZE won't produce any pg_statistic entries,so there's no way to budge the planner off the bad estimate.We'd produce a better estimate in such cases if we used the nd2/nd1selectivity heuristic, so an easy fix is to treat the nd2 estimate asnon-default if we derive it from clamping to the inner rel's rowcountestimate. This won't fix every related case (mainly because the rowcountestimate might be larger than DEFAULT_NUM_DISTINCT), but it seems like asane extension of the existing logic, so let's apply the change in HEADand see if anyone complains. Per bug #14438 from Nikolay Nikitin.Report:https://postgr.es/m/20161128182113.6527.58926@wrigleys.postgresql.orgDiscussion:https://postgr.es/m/31089.1480384713@sss.pgh.pa.us1 parent96fb4c9 commitca5f885
1 file changed
+16
-2
lines changedLines changed: 16 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
2511 | 2511 |
| |
2512 | 2512 |
| |
2513 | 2513 |
| |
| 2514 | + | |
| 2515 | + | |
| 2516 | + | |
| 2517 | + | |
2514 | 2518 |
| |
2515 | 2519 |
| |
2516 |
| - | |
2517 |
| - | |
| 2520 | + | |
| 2521 | + | |
| 2522 | + | |
| 2523 | + | |
| 2524 | + | |
| 2525 | + | |
| 2526 | + | |
| 2527 | + | |
| 2528 | + | |
| 2529 | + | |
| 2530 | + | |
| 2531 | + | |
2518 | 2532 |
| |
2519 | 2533 |
| |
2520 | 2534 |
| |
|
0 commit comments
Comments
(0)