MobilityDB
1.0
|
Functions for selectivity estimation of operators on temporal number types. More...
#include "general/tnumber_selfuncs.h"
#include <assert.h>
#include <math.h>
#include <access/htup_details.h>
#include <catalog/pg_collation.h>
#include <utils/builtins.h>
#include <utils/selfuncs.h>
#include "general/temporal_boxops.h"
#include "general/period.h"
#include "general/rangetypes_ext.h"
#include "general/temporal_util.h"
#include "general/tempcache.h"
#include "general/tbox.h"
#include "general/time_selfuncs.h"
#include "general/temporal_analyze.h"
#include "general/temporal_selfuncs.h"
Functions | |
static int | rbound_bsearch (TypeCacheEntry *typcache, RangeBound *value, RangeBound *hist, int hist_length, bool equal) |
Binary search on an array of range bounds. More... | |
static float8 | get_position (TypeCacheEntry *typcache, RangeBound *value, RangeBound *hist1, RangeBound *hist2) |
Get relative position of value in histogram bin in [0,1] range. More... | |
static double | calc_hist_selectivity_scalar (TypeCacheEntry *typcache, RangeBound *constbound, RangeBound *hist, int hist_nvalues, bool equal) |
Look up the fraction of values less than (or equal, if 'equal' argument is true) a given const in a histogram of range bounds. More... | |
static float8 | get_distance (TypeCacheEntry *typcache, RangeBound *bound1, RangeBound *bound2) |
Measure distance between two range bounds. More... | |
static double | calc_hist_selectivity_contained (TypeCacheEntry *typcache, RangeBound *lower, RangeBound *upper, RangeBound *hist_lower, int hist_nvalues, Datum *length_hist_values, int length_hist_nvalues) |
Calculate selectivity of "var <@ const" operator, ie. More... | |
static double | calc_hist_selectivity_contains (TypeCacheEntry *typcache, RangeBound *lower, RangeBound *upper, RangeBound *hist_lower, int hist_nvalues, Datum *length_hist_values, int length_hist_nvalues) |
Calculate selectivity of "var @> const" operator, ie. More... | |
static double | calc_hist_selectivity (TypeCacheEntry *typcache, VariableStatData *vardata, RangeType *constval, Oid operator) |
Calculate range operator selectivity using histograms of range bounds. More... | |
static bool | tnumber_const_to_tbox (const Node *other, TBOX *box) |
Transform the constant into a temporal box. More... | |
static bool | tnumber_cachedop (Oid operator, CachedOp *cachedOp) |
Returns the enum value associated to the operator. More... | |
static Oid | tnumber_cachedop_rangeop (CachedOp cachedOp) |
Returns the range operator associated to the enum value. More... | |
static double | default_tnumber_selectivity (CachedOp operator) |
Returns a default selectivity estimate for the operator when we don't have statistics or cannot use them for some reason. More... | |
Selectivity | tnumber_sel_internal (PlannerInfo *root, VariableStatData *vardata, TBOX *box, CachedOp cachedOp, Oid basetypid) |
Returns an estimate of the selectivity of the temporal search box and the operator for columns of temporal numbers. More... | |
PGDLLEXPORT Datum | tnumber_sel (PG_FUNCTION_ARGS) |
Estimate the selectivity value of the operators for temporal numbers. More... | |
PGDLLEXPORT Datum | tnumber_joinsel (PG_FUNCTION_ARGS) |
Estimate the join selectivity value of the operators for temporal numbers. More... | |
Functions for selectivity estimation of operators on temporal number types.