forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commitef799bd
committed
Clamp total-tuples estimates for foreign tables to ensure planner sanity.
After running GetForeignRelSize for a foreign table, adjust rel->tuplesto be at least as large as rel->rows. This prevents bizarre behaviorin estimate_num_groups() and perhaps other places, especially in thescenario where rel->tuples is zero because pg_class.reltuples is(suggesting that ANALYZE has never been run for the table). As thingsstood, we'd end up estimating one group out of any GROUP BY on such atable, whereas the default group-count estimate is more likely to resultin a sane plan.Also, clarify in the documentation that GetForeignRelSize has the optionto override the rel->tuples value if it has a better idea of what to usethan what is in pg_class.reltuples.Per report from Jeff Janes. Back-patch to all supported branches.Patch by me; thanks to Etsuro Fujita for reviewDiscussion:https://postgr.es/m/CAMkU=1xNo9cnan+Npxgz0eK7394xmjmKg-QEm8wYG9P5-CcaqQ@mail.gmail.com1 parent79ed1d9 commitef799bd
File tree
2 files changed
+11
-0
lines changed- doc/src/sgml
- src/backend/optimizer/path
2 files changed
+11
-0
lines changedLines changed: 8 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
123 | 123 |
| |
124 | 124 |
| |
125 | 125 |
| |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
126 | 134 |
| |
127 | 135 |
| |
128 | 136 |
| |
|
Lines changed: 3 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
856 | 856 |
| |
857 | 857 |
| |
858 | 858 |
| |
| 859 | + | |
| 860 | + | |
| 861 | + | |
859 | 862 |
| |
860 | 863 |
| |
861 | 864 |
| |
|
0 commit comments
Comments
(0)