postgresql/src/backend
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
..
access Fix serialization anomalies due to race conditions on INSERT. 2015-10-31 14:45:15 -05:00
bootstrap Protect against multixact members wraparound 2015-04-28 11:32:53 -03:00
catalog Rename pg_shdepend.c's typedef "objectType" to SharedDependencyObjectType. 2015-05-24 13:03:45 -04:00
commands Fix handling of inherited check constraints in ALTER COLUMN TYPE (again). 2015-11-20 14:55:28 -05:00
executor Further twiddling of nodeHash.c hashtable sizing calculation. 2015-10-04 15:55:07 -04:00
foreign Update copyright for 2014 2014-01-07 16:05:30 -05:00
lib Misc comment typo fixes. 2014-12-16 16:38:20 +02:00
libpq Fix incorrect order of lock file removal and failure to close() sockets. 2015-08-02 14:55:05 -04:00
main Report more information if pg_perm_setlocale() fails at startup. 2015-06-09 13:37:08 -04:00
nodes Fix planner's cost estimation for SEMI/ANTI joins with inner indexscans. 2015-06-03 11:58:47 -04:00
optimizer Fix documentation error in commit 8703059c6b. 2015-10-01 10:32:13 -04:00
parser Remove spurious semicolons. 2015-03-31 15:13:35 +03:00
po Translation updates 2015-10-05 11:01:04 -04:00
port On Windows, ensure shared memory handle gets closed if not being used. 2015-10-13 11:21:33 -04:00
postmaster Fix typo in bgworker.c 2015-10-30 10:38:39 +01:00
regex Fix enforcement of restrictions inside regexp lookaround constraints. 2015-11-07 12:43:24 -05:00
replication Adopt the GNU convention for handling tar-archive members exceeding 8GB. 2015-11-21 20:22:39 -05:00
rewrite Lock all relations referred to in updatable views 2015-09-08 17:02:56 -04:00
snowball Fix ancient encoding error in hungarian.stop. 2014-06-10 22:48:31 -04:00
storage shm_mq: Third attempt at fixing nowait behavior in shm_mq_receive. 2015-11-03 09:20:34 -05:00
tcop Add recursion depth protections to regular expression matching. 2015-10-02 14:51:58 -04:00
tsearch Cope with more than 64K phrases in a thesaurus dictionary. 2014-11-06 20:52:47 -05:00
utils Make gincostestimate() cope with hypothetical GIN indexes. 2015-12-01 16:24:34 -05:00
.gitignore Add gitignore for mingw/cygwin build outputs 2011-06-09 18:11:47 +02:00
common.mk Remove maintainer-check target, fold into normal build 2013-10-10 20:11:56 -04:00
Makefile AIX: Link the postgres executable with -Wl,-brtllib. 2015-07-15 21:00:30 -04:00
nls.mk Translation updates 2015-02-01 23:18:42 -05:00