PostgreSQL Source Code
git master
|
#include "postgres.h"
#include "access/gist.h"
#include "access/stratnum.h"
#include "utils/datum.h"
#include "utils/float.h"
#include "utils/fmgrprotos.h"
#include "utils/multirangetypes.h"
#include "utils/rangetypes.h"
Go to the source code of this file.
Data Structures | |
struct | SingleBoundSortItem |
struct | ConsiderSplitContext |
struct | NonEmptyRange |
struct | CommonEntry |
Macros | |
#define | CLS_NORMAL 0 /* Ordinary finite range (no bits set) */ |
#define | CLS_LOWER_INF 1 /* Lower bound is infinity */ |
#define | CLS_UPPER_INF 2 /* Upper bound is infinity */ |
#define | CLS_CONTAIN_EMPTY 4 /* Contains underlying empty ranges */ |
#define | CLS_EMPTY 8 /* Special class for empty ranges */ |
#define | CLS_COUNT |
#define | LIMIT_RATIO 0.3 |
#define | INFINITE_BOUND_PENALTY 2.0 |
#define | CONTAIN_EMPTY_PENALTY 1.0 |
#define | DEFAULT_SUBTYPE_DIFF_PENALTY 1.0 |
#define | PLACE_LEFT(range, off) |
#define | PLACE_RIGHT(range, off) |
#define | rangeCopy(r) |
Enumerations | |
enum | SplitLR { SPLIT_LEFT = 0 , SPLIT_RIGHT } |
#define CLS_CONTAIN_EMPTY 4 /* Contains underlying empty ranges */ |
Definition at line 33 of file rangetypes_gist.c.
#define CLS_COUNT |
Definition at line 36 of file rangetypes_gist.c.
#define CLS_EMPTY 8 /* Special class for empty ranges */ |
Definition at line 34 of file rangetypes_gist.c.
#define CLS_LOWER_INF 1 /* Lower bound is infinity */ |
Definition at line 31 of file rangetypes_gist.c.
#define CLS_NORMAL 0 /* Ordinary finite range (no bits set) */ |
Definition at line 30 of file rangetypes_gist.c.
#define CLS_UPPER_INF 2 /* Upper bound is infinity */ |
Definition at line 32 of file rangetypes_gist.c.
#define CONTAIN_EMPTY_PENALTY 1.0 |
Definition at line 47 of file rangetypes_gist.c.
#define DEFAULT_SUBTYPE_DIFF_PENALTY 1.0 |
Definition at line 48 of file rangetypes_gist.c.
#define INFINITE_BOUND_PENALTY 2.0 |
Definition at line 46 of file rangetypes_gist.c.
#define LIMIT_RATIO 0.3 |
Definition at line 43 of file rangetypes_gist.c.
#define PLACE_LEFT | ( | range, | |
off | |||
) |
Definition at line 112 of file rangetypes_gist.c.
#define PLACE_RIGHT | ( | range, | |
off | |||
) |
Definition at line 121 of file rangetypes_gist.c.
#define rangeCopy | ( | r | ) |
Definition at line 131 of file rangetypes_gist.c.
enum SplitLR |
|
static |
Definition at line 1786 of file rangetypes_gist.c.
References DatumGetFloat8(), FunctionCall2Coll(), TypeCacheEntry::rng_collation, TypeCacheEntry::rng_subdiff_finfo, and value.
Referenced by range_gist_consider_split(), range_gist_double_sorting_split(), and range_gist_penalty().
|
static |
Definition at line 1768 of file rangetypes_gist.c.
Referenced by range_gist_double_sorting_split().
|
static |
Definition at line 1702 of file rangetypes_gist.c.
References CLS_CONTAIN_EMPTY, CLS_EMPTY, CLS_LOWER_INF, CLS_UPPER_INF, range(), RANGE_CONTAIN_EMPTY, RANGE_EMPTY, range_get_flags(), RANGE_LB_INF, and RANGE_UB_INF.
Referenced by range_gist_picksplit().
|
static |
Definition at line 1742 of file rangetypes_gist.c.
References a, arg, b, NonEmptyRange::lower, and range_cmp_bounds().
Referenced by range_gist_double_sorting_split().
|
static |
Definition at line 1755 of file rangetypes_gist.c.
References a, arg, b, range_cmp_bounds(), and NonEmptyRange::upper.
Referenced by range_gist_double_sorting_split().
Datum multirange_gist_compress | ( | PG_FUNCTION_ARGS | ) |
Definition at line 243 of file rangetypes_gist.c.
References DatumGetMultirangeTypeP(), gistentryinit, GISTENTRY::key, GISTENTRY::leafkey, multirange_get_typcache(), multirange_get_union_range(), MultirangeTypeGetOid, GISTENTRY::offset, GISTENTRY::page, palloc(), PG_GETARG_POINTER, PG_RETURN_POINTER, RangeTypePGetDatum(), GISTENTRY::rel, and TypeCacheEntry::rngtype.
Datum multirange_gist_consistent | ( | PG_FUNCTION_ARGS | ) |
Definition at line 268 of file rangetypes_gist.c.
References DatumGetMultirangeTypeP(), DatumGetRangeTypeP(), GIST_LEAF, GISTENTRY::key, sort-test::key, OidIsValid, PG_GETARG_DATUM, PG_GETARG_OID, PG_GETARG_POINTER, PG_GETARG_UINT16, PG_RETURN_BOOL, range_get_typcache(), range_gist_consistent_int_element(), range_gist_consistent_int_multirange(), range_gist_consistent_int_range(), range_gist_consistent_leaf_element(), range_gist_consistent_leaf_multirange(), range_gist_consistent_leaf_range(), and RangeTypeGetOid.
|
static |
Definition at line 886 of file rangetypes_gist.c.
References Assert, multirange_get_bounds(), MultirangeIsEmpty, range_cmp_bounds(), range_deserialize(), MultirangeType::rangeCount, and RangeIsEmpty.
Referenced by range_gist_consistent_leaf_multirange().
|
static |
Definition at line 1184 of file rangetypes_gist.c.
References Assert, DatumGetRangeTypeP(), FirstOffsetNumber, i, GISTENTRY::key, GistEntryVector::n, OffsetNumberNext, PLACE_LEFT, PLACE_RIGHT, range(), RangeTypePGetDatum(), GIST_SPLITVEC::spl_ldatum, GIST_SPLITVEC::spl_nleft, GIST_SPLITVEC::spl_nright, GIST_SPLITVEC::spl_rdatum, SPLIT_LEFT, SPLIT_RIGHT, and GistEntryVector::vector.
Referenced by range_gist_picksplit().
|
static |
Definition at line 1619 of file rangetypes_gist.c.
References call_subtype_diff(), context, LIMIT_RATIO, Min, and RangeBound::val.
Referenced by range_gist_double_sorting_split().
Datum range_gist_consistent | ( | PG_FUNCTION_ARGS | ) |
Definition at line 189 of file rangetypes_gist.c.
References DatumGetMultirangeTypeP(), DatumGetRangeTypeP(), GIST_LEAF, GISTENTRY::key, sort-test::key, OidIsValid, PG_GETARG_DATUM, PG_GETARG_OID, PG_GETARG_POINTER, PG_GETARG_UINT16, PG_RETURN_BOOL, range_get_typcache(), range_gist_consistent_int_element(), range_gist_consistent_int_multirange(), range_gist_consistent_int_range(), range_gist_consistent_leaf_element(), range_gist_consistent_leaf_multirange(), range_gist_consistent_leaf_range(), and RangeTypeGetOid.
|
static |
Definition at line 1037 of file rangetypes_gist.c.
References elog, ERROR, sort-test::key, range_contains_elem_internal(), and RANGESTRAT_CONTAINS_ELEM.
Referenced by multirange_gist_consistent(), and range_gist_consistent().
|
static |
Definition at line 975 of file rangetypes_gist.c.
References elog, ERROR, sort-test::key, MultirangeIsEmpty, range_adjacent_multirange_internal(), range_after_multirange_internal(), range_before_multirange_internal(), range_contains_multirange_internal(), range_overlaps_multirange_internal(), range_overleft_multirange_internal(), range_overright_multirange_internal(), RangeIsEmpty, RangeIsOrContainsEmpty, RANGESTRAT_ADJACENT, RANGESTRAT_AFTER, RANGESTRAT_BEFORE, RANGESTRAT_CONTAINED_BY, RANGESTRAT_CONTAINS, RANGESTRAT_EQ, RANGESTRAT_OVERLAPS, RANGESTRAT_OVERLEFT, and RANGESTRAT_OVERRIGHT.
Referenced by multirange_gist_consistent(), and range_gist_consistent().
|
static |
Definition at line 913 of file rangetypes_gist.c.
References elog, ERROR, sort-test::key, range_adjacent_internal(), range_after_internal(), range_before_internal(), range_contains_internal(), range_overlaps_internal(), range_overleft_internal(), range_overright_internal(), RangeIsEmpty, RangeIsOrContainsEmpty, RANGESTRAT_ADJACENT, RANGESTRAT_AFTER, RANGESTRAT_BEFORE, RANGESTRAT_CONTAINED_BY, RANGESTRAT_CONTAINS, RANGESTRAT_EQ, RANGESTRAT_OVERLAPS, RANGESTRAT_OVERLEFT, and RANGESTRAT_OVERRIGHT.
Referenced by multirange_gist_consistent(), and range_gist_consistent().
|
static |
Definition at line 1126 of file rangetypes_gist.c.
References elog, ERROR, sort-test::key, range_contains_elem_internal(), and RANGESTRAT_CONTAINS_ELEM.
Referenced by multirange_gist_consistent(), and range_gist_consistent().
|
static |
Definition at line 1091 of file rangetypes_gist.c.
References elog, ERROR, sort-test::key, multirange_contains_range_internal(), multirange_union_range_equal(), range_adjacent_multirange_internal(), range_after_multirange_internal(), range_before_multirange_internal(), range_contains_multirange_internal(), range_overlaps_multirange_internal(), range_overleft_multirange_internal(), range_overright_multirange_internal(), RANGESTRAT_ADJACENT, RANGESTRAT_AFTER, RANGESTRAT_BEFORE, RANGESTRAT_CONTAINED_BY, RANGESTRAT_CONTAINS, RANGESTRAT_EQ, RANGESTRAT_OVERLAPS, RANGESTRAT_OVERLEFT, and RANGESTRAT_OVERRIGHT.
Referenced by multirange_gist_consistent(), and range_gist_consistent().
|
static |
Definition at line 1056 of file rangetypes_gist.c.
References elog, ERROR, sort-test::key, range_adjacent_internal(), range_after_internal(), range_before_internal(), range_contained_by_internal(), range_contains_internal(), range_eq_internal(), range_overlaps_internal(), range_overleft_internal(), range_overright_internal(), RANGESTRAT_ADJACENT, RANGESTRAT_AFTER, RANGESTRAT_BEFORE, RANGESTRAT_CONTAINED_BY, RANGESTRAT_CONTAINS, RANGESTRAT_EQ, RANGESTRAT_OVERLAPS, RANGESTRAT_OVERLEFT, and RANGESTRAT_OVERRIGHT.
Referenced by multirange_gist_consistent(), and range_gist_consistent().
|
static |
Definition at line 1316 of file rangetypes_gist.c.
References Assert, call_subtype_diff(), common_entry_cmp(), context, DatumGetRangeTypeP(), CommonEntry::delta, FirstOffsetNumber, FmgrInfo::fn_oid, i, idx(), CommonEntry::index, interval_cmp_lower(), interval_cmp_upper(), GISTENTRY::key, lower(), NonEmptyRange::lower, GistEntryVector::n, OffsetNumberNext, OidIsValid, palloc(), PLACE_LEFT, PLACE_RIGHT, PointerGetDatum(), qsort, qsort_arg(), range(), range_cmp_bounds(), range_deserialize(), range_gist_consider_split(), range_gist_fallback_split(), TypeCacheEntry::rng_subdiff_finfo, GIST_SPLITVEC::spl_ldatum, GIST_SPLITVEC::spl_left, GIST_SPLITVEC::spl_nleft, GIST_SPLITVEC::spl_nright, GIST_SPLITVEC::spl_rdatum, GIST_SPLITVEC::spl_right, upper(), NonEmptyRange::upper, and GistEntryVector::vector.
Referenced by range_gist_picksplit().
|
static |
Definition at line 1146 of file rangetypes_gist.c.
References DatumGetRangeTypeP(), FirstOffsetNumber, i, GISTENTRY::key, GistEntryVector::n, PLACE_LEFT, PLACE_RIGHT, range(), RangeTypePGetDatum(), GIST_SPLITVEC::spl_ldatum, GIST_SPLITVEC::spl_nleft, GIST_SPLITVEC::spl_nright, GIST_SPLITVEC::spl_rdatum, and GistEntryVector::vector.
Referenced by range_gist_double_sorting_split(), and range_gist_picksplit().
Datum range_gist_penalty | ( | PG_FUNCTION_ARGS | ) |
Definition at line 360 of file rangetypes_gist.c.
References call_subtype_diff(), CONTAIN_EMPTY_PENALTY, DatumGetRangeTypeP(), DEFAULT_SUBTYPE_DIFF_PENALTY, elog, ERROR, FmgrInfo::fn_oid, get_float4_infinity(), RangeBound::infinite, INFINITE_BOUND_PENALTY, GISTENTRY::key, OidIsValid, PG_GETARG_POINTER, PG_RETURN_POINTER, range_cmp_bounds(), range_deserialize(), range_get_typcache(), RangeIsOrContainsEmpty, RangeTypeGetOid, TypeCacheEntry::rng_subdiff_finfo, and RangeBound::val.
Datum range_gist_picksplit | ( | PG_FUNCTION_ARGS | ) |
Definition at line 617 of file rangetypes_gist.c.
References Assert, CLS_CONTAIN_EMPTY, CLS_COUNT, CLS_EMPTY, CLS_LOWER_INF, CLS_NORMAL, CLS_UPPER_INF, DatumGetRangeTypeP(), FirstOffsetNumber, get_gist_range_class(), i, j, GISTENTRY::key, GistEntryVector::n, OffsetNumberNext, palloc(), PG_GETARG_POINTER, PG_RETURN_POINTER, range(), range_get_typcache(), range_gist_class_split(), range_gist_double_sorting_split(), range_gist_fallback_split(), range_gist_single_sorting_split(), RangeTypeGetOid, GIST_SPLITVEC::spl_left, GIST_SPLITVEC::spl_right, SPLIT_RIGHT, and GistEntryVector::vector.
Datum range_gist_same | ( | PG_FUNCTION_ARGS | ) |
Definition at line 776 of file rangetypes_gist.c.
References PG_GETARG_POINTER, PG_GETARG_RANGE_P, PG_RETURN_POINTER, range_eq_internal(), range_get_flags(), range_get_typcache(), and RangeTypeGetOid.
|
static |
Definition at line 1227 of file rangetypes_gist.c.
References Assert, DatumGetRangeTypeP(), FirstOffsetNumber, i, idx(), SingleBoundSortItem::index, GISTENTRY::key, GistEntryVector::n, OffsetNumberNext, palloc(), PLACE_LEFT, PLACE_RIGHT, qsort_arg(), range(), range_deserialize(), RangeTypePGetDatum(), single_bound_cmp(), GIST_SPLITVEC::spl_ldatum, GIST_SPLITVEC::spl_nleft, GIST_SPLITVEC::spl_nright, GIST_SPLITVEC::spl_rdatum, and GistEntryVector::vector.
Referenced by range_gist_picksplit().
Datum range_gist_union | ( | PG_FUNCTION_ARGS | ) |
Definition at line 322 of file rangetypes_gist.c.
References DatumGetRangeTypeP(), i, sort-test::key, GistEntryVector::n, PG_GETARG_POINTER, PG_RETURN_RANGE_P, range_get_typcache(), range_super_union(), RangeTypeGetOid, and GistEntryVector::vector.
|
static |
Definition at line 819 of file rangetypes_gist.c.
References make_range(), range_cmp_bounds(), RANGE_CONTAIN_EMPTY, range_deserialize(), RANGE_EMPTY, range_get_flags(), range_set_contain_empty(), and rangeCopy.
Referenced by range_gist_union().
|
static |
Definition at line 1729 of file rangetypes_gist.c.
References a, arg, b, SingleBoundSortItem::bound, and range_cmp_bounds().
Referenced by range_gist_single_sorting_split().