PostGIS  2.5.7dev-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 1860 of file gserialized_estimate.c.

1862 {
1863  /* 2D Mode */
1864  compute_gserialized_stats_mode(stats, fetchfunc, sample_rows, total_rows, 2);
1865  /* ND Mode */
1866  compute_gserialized_stats_mode(stats, fetchfunc, sample_rows, total_rows, 0);
1867 }
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...

References compute_gserialized_stats_mode().

Referenced by gserialized_analyze_nd().

Here is the call graph for this function:
Here is the caller graph for this function: