Make gincostestimate() cope with hypothetical GIN indexes.
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.

greenplum-db/gpdb,ashwinstar/gpdb,50wu/gpdb,greenplum-db/gpdb,adam8157/gpdb,lisakowen/gpdb,adam8157/gpdb,50wu/gpdb,xinzweb/gpdb,xinzweb/gpdb,lisakowen/gpdb,lisakowen/gpdb,greenplum-db/gpdb,50wu/gpdb,greenplum-db/gpdb,jmcatamney/gpdb,xinzweb/gpdb,adam8157/gpdb,ashwinstar/gpdb,jmcatamney/gpdb,xinzweb/gpdb,50wu/gpdb,adam8157/gpdb,50wu/gpdb,xinzweb/gpdb,xinzweb/gpdb,adam8157/gpdb,adam8157/gpdb,jmcatamney/gpdb,lisakowen/gpdb,jmcatamney/gpdb,adam8157/gpdb,ashwinstar/gpdb,jmcatamney/gpdb,ashwinstar/gpdb,50wu/gpdb,ashwinstar/gpdb,lisakowen/gpdb,adam8157/gpdb,ashwinstar/gpdb,jmcatamney/gpdb,greenplum-db/gpdb,xinzweb/gpdb,xinzweb/gpdb,greenplum-db/gpdb,jmcatamney/gpdb,lisakowen/gpdb,greenplum-db/gpdb,greenplum-db/gpdb,lisakowen/gpdb,lisakowen/gpdb,50wu/gpdb,50wu/gpdb,ashwinstar/gpdb,ashwinstar/gpdb,jmcatamney/gpdb