- Notifications
You must be signed in to change notification settings - Fork4.9k
Commitab14e0e
committed
Make gincostestimate() cope with hypothetical GIN indexes.
We tried to fetch statistics data from the index metapage, which does notwork if the index isn't actually present. If the index is hypothetical,instead extrapolate some plausible internal statistics based on the indexpage count provided by the index-advisor plugin.There was already some code in gincostestimate() to invent internal statsin this way, but since it was only meant as a stopgap for pre-9.1 GINindexes that hadn't been vacuumed since upgrading, it was pretty crude.If we want it to support index advisors, we should try a little harder.A small amount of testing says that it's better to estimate the entry pagesas 90% of the index, not 100%. Also, estimating the number of entries(keys) as equal to the heap tuple count could be wildly wrong in eitherdirection. Instead, let's estimate 100 entries per entry page.Perhaps someday somebody will want the index advisor to be able to providethese numbers more directly, but for the moment this should serve.Problem report and initial patch by Julien Rouhaud; modified by me toinvent less-bogus internal statistics. Back-patch to all supportedbranches, since we've supported index advisors since 9.0.1 parent346cc2f commitab14e0e
1 file changed
+38
-20
lines changedLines changed: 38 additions & 20 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
7095 | 7095 |
| |
7096 | 7096 |
| |
7097 | 7097 |
| |
7098 |
| - | |
| 7098 | + | |
| 7099 | + | |
7099 | 7100 |
| |
7100 |
| - | |
7101 |
| - | |
7102 |
| - | |
7103 |
| - | |
7104 |
| - | |
7105 |
| - | |
7106 |
| - | |
7107 |
| - | |
7108 |
| - | |
7109 |
| - | |
7110 |
| - | |
7111 |
| - | |
7112 |
| - | |
7113 |
| - | |
7114 |
| - | |
7115 |
| - | |
| 7101 | + | |
7116 | 7102 |
| |
7117 |
| - | |
7118 |
| - | |
7119 |
| - | |
| 7103 | + | |
| 7104 | + | |
| 7105 | + | |
7120 | 7106 |
| |
7121 | 7107 |
| |
7122 | 7108 |
| |
| 7109 | + | |
| 7110 | + | |
| 7111 | + | |
| 7112 | + | |
| 7113 | + | |
| 7114 | + | |
| 7115 | + | |
| 7116 | + | |
| 7117 | + | |
| 7118 | + | |
7123 | 7119 |
| |
7124 | 7120 |
| |
| 7121 | + | |
| 7122 | + | |
| 7123 | + | |
| 7124 | + | |
| 7125 | + | |
7125 | 7126 |
| |
7126 | 7127 |
| |
7127 | 7128 |
| |
7128 | 7129 |
| |
7129 | 7130 |
| |
7130 | 7131 |
| |
7131 | 7132 |
| |
| 7133 | + | |
| 7134 | + | |
| 7135 | + | |
| 7136 | + | |
| 7137 | + | |
| 7138 | + | |
| 7139 | + | |
| 7140 | + | |
| 7141 | + | |
| 7142 | + | |
| 7143 | + | |
| 7144 | + | |
| 7145 | + | |
| 7146 | + | |
| 7147 | + | |
| 7148 | + | |
| 7149 | + | |
7132 | 7150 |
| |
7133 | 7151 |
| |
7134 | 7152 |
| |
|
0 commit comments
Comments
(0)