PostGIS  2.1.10dev-r@@SVN_REVISION@@
static void compute_gserialized_stats ( VacAttrStats *  stats,
AnalyzeAttrFetchFunc  fetchfunc,
int  sample_rows,
double  total_rows 

In order to do useful selectivity calculations in both 2-D and N-D modes, we actually have to generate two stats objects, one for 2-D and one for N-D.

You would think that an N-D histogram would be sufficient for 2-D calculations of selectivity, but you'd be wrong. For features that overlap multiple cells, the N-D histogram over-estimates the number of hits, and can't contain the requisite information to correct that over-estimate. We use the convenient PgSQL facility of stats slots to store one 2-D and one N-D stats object, and here in the compute function we just call the computation twice, once in each mode. It would be more efficient to have the computation calculate the two histograms simultaneously, but that would also complicate the (already complicated) logic in the function, so we'll take the CPU hit and do the computation twice.

Definition at line 1701 of file gserialized_estimate.c.

References compute_gserialized_stats_mode().

Referenced by gserialized_analyze_nd().

1703 {
1704  /* 2D Mode */
1705  compute_gserialized_stats_mode(stats, fetchfunc, sample_rows, total_rows, 2);
1706  /* ND Mode */
1707  compute_gserialized_stats_mode(stats, fetchfunc, sample_rows, total_rows, 0);
1708 }
static void compute_gserialized_stats_mode(VacAttrStats *stats, AnalyzeAttrFetchFunc fetchfunc, int sample_rows, double total_rows, int mode)
The gserialized_analyze_nd sets this function as a callback on the stats object when called by the AN...

Here is the call graph for this function:

Here is the caller graph for this function: