PostGIS  2.5.1dev-r@@SVN_REVISION@@

◆ compute_gserialized_stats()

static void compute_gserialized_stats ( VacAttrStats *  stats,
AnalyzeAttrFetchFunc  fetchfunc,
int  sample_rows,
double  total_rows 
)
static

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 1854 of file gserialized_estimate.c.

References compute_gserialized_stats_mode(), gserialized_analyze_nd(), and PG_FUNCTION_INFO_V1().

Referenced by gserialized_analyze_nd().

1856 {
1857  /* 2D Mode */
1858  compute_gserialized_stats_mode(stats, fetchfunc, sample_rows, total_rows, 2);
1859  /* ND Mode */
1860  compute_gserialized_stats_mode(stats, fetchfunc, sample_rows, total_rows, 0);
1861 }
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: