MobilityDB
1.0
|
Functions for gathering statistics from temporal alphanumeric columns. More...
#include "general/temporal_analyze.h"
#include <assert.h>
#include <math.h>
#include <access/tuptoaster.h>
#include <catalog/pg_collation.h>
#include <catalog/pg_operator.h>
#include <commands/vacuum.h>
#include <parser/parse_oper.h>
#include <utils/datum.h>
#include <utils/fmgrprotos.h>
#include <utils/lsyscache.h>
#include <utils/timestamp.h>
#include "general/period.h"
#include "general/time_analyze.h"
#include "general/rangetypes_ext.h"
#include "general/temporaltypes.h"
#include "general/tempcache.h"
#include "general/temporal_util.h"
Macros | |
#define | TEMPORAL_WIDTH_THRESHOLD 4096 |
Functions | |
static int | range_bound_qsort_cmp (const void *a1, const void *a2, void *arg) |
Comparison function for sorting RangeBounds. More... | |
void | range_compute_stats (VacAttrStats *stats, int non_null_cnt, int *slot_idx, RangeBound *lowers, RangeBound *uppers, float8 *lengths, TypeCacheEntry *typcache, Oid rangetypid) |
Compute statistics for the value dimension (that is ranges) for temporal numbers. More... | |
static void | temp_compute_stats (VacAttrStats *stats, AnalyzeAttrFetchFunc fetchfunc, int samplerows, bool valuestats) |
Compute statistics for temporal columns. More... | |
void | temporal_extra_info (VacAttrStats *stats) |
Collect extra information about the temporal type and its base and time types. More... | |
void | temporal_compute_stats (VacAttrStats *stats, AnalyzeAttrFetchFunc fetchfunc, int samplerows, double totalrows) |
Compute the statistics for temporal columns where only the time dimension is considered. More... | |
void | tnumber_compute_stats (VacAttrStats *stats, AnalyzeAttrFetchFunc fetchfunc, int samplerows, double totalrows) |
Compute the statistics for temporal number columns. More... | |
Datum | generic_analyze (FunctionCallInfo fcinfo, void(*func)(VacAttrStats *, AnalyzeAttrFetchFunc, int, double)) |
Generic analyze function for temporal columns. More... | |
PGDLLEXPORT Datum | temporal_analyze (PG_FUNCTION_ARGS) |
Compute the statistics for temporal columns where only the time dimension is considered. More... | |
PGDLLEXPORT Datum | tnumber_analyze (PG_FUNCTION_ARGS) |
Compute the statistics for temporal number columns. More... | |
Variables | |
TemporalAnalyzeExtraData * | temporal_extra_data |
Functions for gathering statistics from temporal alphanumeric columns.
Various kind of statistics are collected for both the value and the time dimension of temporal types. Please refer to the PostgreSQL file pg_statistic_d.h for more information about the statistics collected.
stakind
contains the type of statistics which is STATISTIC_KIND_BOUNDS_HISTOGRAM
.staop
contains the "<" operator of the value dimension.stavalues
stores the histogram of ranges for the value dimension.numvalues
contains the number of buckets in the histogram.stakind
contains the type of statistics which is STATISTIC_KIND_RANGE_LENGTH_HISTOGRAM
.staop
contains the "<" operator to the value dimension.stavalues
stores the length of the histogram of ranges for the value dimension.numvalues
contains the number of buckets in the histogram.stakind
contains the type of statistics which is STATISTIC_KIND_PERIOD_BOUNDS_HISTOGRAM
.staop
contains the "<" operator of the time dimension.stavalues
stores the histogram of periods for the time dimension.numvalues
contains the number of buckets in the histogram.stakind
contains the type of statistics which is STATISTIC_KIND_PERIOD_LENGTH_HISTOGRAM
.staop
contains the "<" operator of the time dimension.stavalues
stores the length of the histogram of periods for the time dimension.numvalues
contains the number of buckets in the histogram.In the case of temporal types having a Period as bounding box, that is, tbool and ttext, no statistics are collected for the value dimension and the statistics for the temporal part are stored in slots 1 and 2.