MobilityDB
1.0
|
Functions for gathering statistics from time type columns. More...
#include "general/time_analyze.h"
#include <assert.h>
#include <catalog/pg_operator.h>
#include <commands/vacuum.h>
#include "general/timestampset.h"
#include "general/period.h"
#include "general/periodset.h"
#include "general/temporal.h"
#include "general/tempcache.h"
Functions | |
static void | timetype_compute_stats (CachedType timetype, VacAttrStats *stats, AnalyzeAttrFetchFunc fetchfunc, int samplerows) |
Compute statistics for timestamp set, period, and period set columns. More... | |
static void | period_compute_stats (VacAttrStats *stats, AnalyzeAttrFetchFunc fetchfunc, int samplerows, double totalrows) |
Compute statistics for period columns (callback function) More... | |
static void | timestampset_compute_stats (VacAttrStats *stats, AnalyzeAttrFetchFunc fetchfunc, int samplerows, double totalrows) |
Compute statistics for timestampset columns (callback function) More... | |
static void | periodset_compute_stats (VacAttrStats *stats, AnalyzeAttrFetchFunc fetchfunc, int samplerows, double totalrows) |
Compute statistics for period set columns (callback function) More... | |
int | float8_qsort_cmp (const void *a1, const void *a2) |
Comparison function for sorting float8 values, used for period lengths. More... | |
void | period_compute_stats1 (VacAttrStats *stats, int non_null_cnt, int *slot_idx, PeriodBound *lowers, PeriodBound *uppers, float8 *lengths) |
Compute statistics for period columns and for the time dimension of all temporal types whose subtype is not instant. More... | |
PGDLLEXPORT Datum | period_analyze (PG_FUNCTION_ARGS) |
Compute statistics for period columns. More... | |
PGDLLEXPORT Datum | timestampset_analyze (PG_FUNCTION_ARGS) |
Compute statistics for timestamp set columns. More... | |
PGDLLEXPORT Datum | periodset_analyze (PG_FUNCTION_ARGS) |
Compute statistics for period set columns. More... | |
Functions for gathering statistics from time type columns.
These functions are based on those of the file rangetypes_typanalyze.c. For a period type column, histograms of lower and upper bounds, and the fraction of NULL periods are collected.
Both histograms have the same length, and they are combined into a single array of periods. This has the same shape as the histogram that std_typanalyze would collect, but the values are different. Each period in the array is a valid period, 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.