MobilityDB 1.3
Loading...
Searching...
No Matches
Functions
span_analyze.c File Reference

Functions for gathering statistics from span type columns. More...

#include "pg_temporal/span_analyze.h"
#include <assert.h>
#include <postgres.h>
#include <fmgr.h>
#include <catalog/pg_operator.h>
#include <utils/typcache.h>
#include <meos.h>
#include <meos_internal.h>
#include "temporal/set.h"
#include "pg_temporal/meos_catalog.h"

Functions

static int float8_qsort_cmp (const void *a1, const void *a2)
 Comparison function for sorting float8 values, used for span lengths. More...
 
Datum Span_analyze (PG_FUNCTION_ARGS)
 Compute statistics for span columns. More...
 
static void span_compute_stats (VacAttrStats *stats, AnalyzeAttrFetchFunc fetchfunc, int samplerows, double totalrows UNUSED)
 Compute statistics for set, span, and span set columns. More...
 
void span_compute_stats_generic (VacAttrStats *stats, int non_null_cnt, int *slot_idx, SpanBound *lowers, SpanBound *uppers, float8 *lengths, bool valuedim)
 Compute statistics for span type columns and for the time dimension of temporal types whose subtype is not instant. More...
 

Detailed Description

Functions for gathering statistics from span type columns.

These functions are based on those of the file rangetypes_typanalyze.c. For a span type column, histograms of lower and upper bounds, and the fraction of NULL spans are collected.

Both histograms have the same length, and they are combined into a single array of spans. This has the same shape as the histogram that std_typanalyze would collect, but the values are different. Each span in the array is a valid span, even though the lower and upper bounds come from different tuples. In theory, the standard scalar selectivity functions could be used with the combined histogram.