postgresql/src/backend/utils
Tom Lane ab14e0e4c8 Make gincostestimate() cope with hypothetical GIN indexes.
We tried to fetch statistics data from the index metapage, which does not
work if the index isn't actually present.  If the index is hypothetical,
instead extrapolate some plausible internal statistics based on the index
page count provided by the index-advisor plugin.

There was already some code in gincostestimate() to invent internal stats
in this way, but since it was only meant as a stopgap for pre-9.1 GIN
indexes 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 pages
as 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 either
direction.  Instead, let's estimate 100 entries per entry page.

Perhaps someday somebody will want the index advisor to be able to provide
these numbers more directly, but for the moment this should serve.

Problem report and initial patch by Julien Rouhaud; modified by me to
invent less-bogus internal statistics.  Back-patch to all supported
branches, since we've supported index advisors since 9.0.
2015-12-01 16:24:34 -05:00
..
adt Make gincostestimate() cope with hypothetical GIN indexes. 2015-12-01 16:24:34 -05:00
cache Fix subtransaction cleanup after an outer-subtransaction portal fails. 2015-09-04 13:37:17 -04:00
error Be more careful to not lose sync in the FE/BE protocol. 2015-02-02 17:09:46 +02:00
fmgr pgindent run for 9.4 2014-05-06 12:12:18 -04:00
hash pgindent run for 9.4 2014-05-06 12:12:18 -04:00
init Perform an immediate shutdown if the postmaster.pid file is removed. 2015-10-06 17:15:27 -04:00
mb Encoding PG_UHC is code page 949. 2015-08-14 20:23:42 -04:00
misc Lower *_freeze_max_age minimum values. 2015-09-24 14:53:33 +02:00
mmgr Fix subtransaction cleanup after an outer-subtransaction portal fails. 2015-09-04 13:37:17 -04:00
resowner pgindent run for 9.4 2014-05-06 12:12:18 -04:00
sort Fix bogus "out of memory" reports in tuplestore.c. 2015-08-04 18:18:46 -04:00
time Fix failure to consider failure cases in GetComboCommandId(). 2015-11-26 13:23:02 -05:00
.gitignore Avoid maintaining three separate copies of the error codes list. 2011-02-03 22:32:49 -05:00
errcodes.txt Update copyright for 2014 2014-01-07 16:05:30 -05:00
Gen_dummy_probes.sed Update copyright for 2014 2014-01-07 16:05:30 -05:00
Gen_fmgrtab.pl Update copyright for 2014 2014-01-07 16:05:30 -05:00
generate-errcodes.pl Update copyright for 2014 2014-01-07 16:05:30 -05:00
Makefile Make handling of errcodes.h more consistent with other generated headers. 2011-02-04 09:29:10 -05:00
probes.d Fix build with LWLOCK_STATS or dtrace. 2014-03-21 23:26:34 +01:00