PostgreSQL Source Code
git master
|
Go to the source code of this file.
Data Structures | |
struct | StdAnalyzeData |
struct | ScalarItem |
struct | DimensionInfo |
struct | MultiSortSupportData |
struct | SortItem |
struct | StatsBuildData |
Typedefs | |
typedef struct DimensionInfo | DimensionInfo |
typedef struct MultiSortSupportData | MultiSortSupportData |
typedef MultiSortSupportData * | MultiSortSupport |
typedef struct SortItem | SortItem |
typedef struct StatsBuildData | StatsBuildData |
typedef struct DimensionInfo DimensionInfo |
typedef MultiSortSupportData* MultiSortSupport |
Definition at line 51 of file extended_stats_internal.h.
typedef struct MultiSortSupportData MultiSortSupportData |
typedef struct StatsBuildData StatsBuildData |
AttrNumber* build_attnums_array | ( | Bitmapset * | attrs, |
int | nexprs, | ||
int * | numattrs | ||
) |
Definition at line 941 of file extended_stats.c.
References Assert, attnum, AttributeNumberIsValid, bms_next_member(), bms_num_members(), i, j, MaxAttrNumber, and palloc().
SortItem* build_sorted_items | ( | StatsBuildData * | data, |
int * | nitems, | ||
MultiSortSupport | mss, | ||
int | numattrs, | ||
AttrNumber * | attnums | ||
) |
Definition at line 986 of file extended_stats.c.
References Assert, attlen, attnum, data, get_typlen(), i, idx(), items, j, len, multi_sort_compare(), nitems, palloc(), palloc0(), pfree(), PG_DETOAST_DATUM, PointerGetDatum(), qsort_interruptible(), toast_raw_datum_size(), value, values, and WIDTH_THRESHOLD.
Referenced by dependency_degree(), and statext_mcv_build().
int compare_datums_simple | ( | Datum | a, |
Datum | b, | ||
SortSupport | ssup | ||
) |
Definition at line 927 of file extended_stats.c.
References a, ApplySortComparator(), and b.
Referenced by compare_scalars_simple(), and statext_mcv_serialize().
int compare_scalars_simple | ( | const void * | a, |
const void * | b, | ||
void * | arg | ||
) |
Definition at line 919 of file extended_stats.c.
References a, arg, b, and compare_datums_simple().
Referenced by statext_mcv_serialize().
Definition at line 2055 of file extended_stats.c.
References arg, generate_unaccent_rules::args, Assert, IsA, linitial, list_length(), and lsecond.
Referenced by mcv_get_match_bitmap(), and statext_is_compatible_clause_internal().
Selectivity mcv_clause_selectivity_or | ( | PlannerInfo * | root, |
StatisticExtInfo * | stat, | ||
MCVList * | mcv, | ||
Node * | clause, | ||
bool ** | or_matches, | ||
Selectivity * | basesel, | ||
Selectivity * | overlap_mcvsel, | ||
Selectivity * | overlap_basesel, | ||
Selectivity * | totalsel | ||
) |
Definition at line 2126 of file mcv.c.
References MCVItem::base_frequency, MCVItem::frequency, i, MCVList::items, list_make1, mcv_get_match_bitmap(), MCVList::nitems, palloc0(), pfree(), and root.
Referenced by statext_mcv_clauselist_selectivity().
Selectivity mcv_clauselist_selectivity | ( | PlannerInfo * | root, |
StatisticExtInfo * | stat, | ||
List * | clauses, | ||
int | varRelid, | ||
JoinType | jointype, | ||
SpecialJoinInfo * | sjinfo, | ||
RelOptInfo * | rel, | ||
Selectivity * | basesel, | ||
Selectivity * | totalsel | ||
) |
Definition at line 2048 of file mcv.c.
References MCVItem::base_frequency, MCVItem::frequency, i, RangeTblEntry::inh, MCVList::items, mcv_get_match_bitmap(), MCVList::nitems, RelOptInfo::relid, root, and statext_mcv_load().
Referenced by statext_mcv_clauselist_selectivity().
Selectivity mcv_combine_selectivities | ( | Selectivity | simple_sel, |
Selectivity | mcv_sel, | ||
Selectivity | mcv_basesel, | ||
Selectivity | mcv_totalsel | ||
) |
Definition at line 2006 of file mcv.c.
References CLAMP_PROBABILITY.
Referenced by statext_mcv_clauselist_selectivity().
void multi_sort_add_dimension | ( | MultiSortSupport | mss, |
int | sortdim, | ||
Oid | oper, | ||
Oid | collation | ||
) |
Definition at line 851 of file extended_stats.c.
References CurrentMemoryContext, oper(), PrepareSortSupportFromOrderingOp(), MultiSortSupportData::ssup, SortSupportData::ssup_collation, SortSupportData::ssup_cxt, and SortSupportData::ssup_nulls_first.
Referenced by build_mss(), dependency_degree(), and ndistinct_for_combination().
int multi_sort_compare | ( | const void * | a, |
const void * | b, | ||
void * | arg | ||
) |
Definition at line 865 of file extended_stats.c.
References a, ApplySortComparator(), arg, b, compare(), i, SortItem::isnull, MultiSortSupportData::ndims, MultiSortSupportData::ssup, and SortItem::values.
Referenced by build_distinct_groups(), build_sorted_items(), count_distinct_groups(), ndistinct_for_combination(), and statext_mcv_build().
int multi_sort_compare_dim | ( | int | dim, |
const SortItem * | a, | ||
const SortItem * | b, | ||
MultiSortSupport | mss | ||
) |
Definition at line 890 of file extended_stats.c.
References a, ApplySortComparator(), b, and MultiSortSupportData::ssup.
Referenced by dependency_degree().
int multi_sort_compare_dims | ( | int | start, |
int | end, | ||
const SortItem * | a, | ||
const SortItem * | b, | ||
MultiSortSupport | mss | ||
) |
Definition at line 899 of file extended_stats.c.
References a, ApplySortComparator(), b, MultiSortSupportData::ssup, and start.
Referenced by dependency_degree().
MultiSortSupport multi_sort_init | ( | int | ndims | ) |
Definition at line 832 of file extended_stats.c.
References Assert, MultiSortSupportData::ndims, and palloc0().
Referenced by build_mss(), dependency_degree(), and ndistinct_for_combination().
MVDependencies* statext_dependencies_build | ( | StatsBuildData * | data | ) |
Definition at line 348 of file dependencies.c.
References ALLOCSET_DEFAULT_SIZES, AllocSetContextCreate, Assert, MVDependency::attributes, CurrentMemoryContext, data, MVDependency::degree, dependency_degree(), DependencyGenerator_free(), DependencyGenerator_init(), DependencyGenerator_next(), MVDependencies::deps, i, if(), MVDependencies::magic, MemoryContextDelete(), MemoryContextReset(), MemoryContextSwitchTo(), MVDependency::nattributes, MVDependencies::ndeps, palloc0(), repalloc(), STATS_DEPS_MAGIC, STATS_DEPS_TYPE_BASIC, and MVDependencies::type.
Referenced by BuildRelationExtStatistics().
MVDependencies* statext_dependencies_deserialize | ( | bytea * | data | ) |
Definition at line 499 of file dependencies.c.
References Assert, MVDependency::attributes, data, MVDependency::degree, MVDependencies::deps, elog, ERROR, i, MVDependencies::magic, MVDependency::nattributes, MVDependencies::ndeps, palloc0(), repalloc(), SizeOfHeader, SizeOfItem, STATS_DEPS_MAGIC, STATS_DEPS_TYPE_BASIC, STATS_MAX_DIMENSIONS, MVDependencies::type, VARDATA_ANY, VARSIZE_ANY, and VARSIZE_ANY_EXHDR.
Referenced by pg_dependencies_out(), and statext_dependencies_load().
bytea* statext_dependencies_serialize | ( | MVDependencies * | dependencies | ) |
Definition at line 444 of file dependencies.c.
References Assert, MVDependency::attributes, MVDependency::degree, MVDependencies::deps, i, len, MVDependencies::magic, MVDependency::nattributes, MVDependencies::ndeps, output, palloc0(), SET_VARSIZE, SizeOfHeader, SizeOfItem, MVDependencies::type, VARDATA, and VARHDRSZ.
Referenced by statext_store().
MCVList* statext_mcv_build | ( | StatsBuildData * | data, |
double | totalrows, | ||
int | stattarget | ||
) |
Definition at line 180 of file mcv.c.
References Assert, MCVItem::base_frequency, bsearch_arg(), build_column_frequencies(), build_distinct_groups(), build_mss(), build_sorted_items(), SortItem::count, data, for(), MCVItem::frequency, get_mincount_for_mcv_list(), i, SortItem::isnull, MCVItem::isnull, MCVList::items, items, j, sort-test::key, MCVList::magic, multi_sort_compare(), MCVList::ndimensions, MultiSortSupportData::ndims, MCVList::nitems, nitems, palloc(), palloc0(), pfree(), MultiSortSupportData::ssup, STATS_MCV_MAGIC, STATS_MCV_TYPE_BASIC, MCVList::type, MCVList::types, SortItem::values, and MCVItem::values.
Referenced by BuildRelationExtStatistics().
Definition at line 996 of file mcv.c.
References Assert, MCVItem::base_frequency, data, elog, ERROR, fetch_att(), MCVItem::frequency, i, MCVItem::isnull, MCVList::items, items, len, MCVList::magic, MAXALIGN, MinSizeOfMCVList, DimensionInfo::nbytes, DimensionInfo::nbytes_aligned, MCVList::ndimensions, MCVList::nitems, nitems, DimensionInfo::nvalues, palloc(), palloc0(), pfree(), PG_USED_FOR_ASSERTS_ONLY, PointerGetDatum(), repalloc(), SET_VARSIZE, SizeOfMCVList, start, STATS_MAX_DIMENSIONS, STATS_MCV_MAGIC, STATS_MCV_TYPE_BASIC, STATS_MCVLIST_MAX_ITEMS, MCVList::type, MCVList::types, DimensionInfo::typlen, MCVItem::values, VARDATA, VARDATA_ANY, VARHDRSZ, and VARSIZE_ANY.
Referenced by pg_stats_ext_mcvlist_items(), and statext_mcv_load().
bytea* statext_mcv_serialize | ( | MCVList * | mcvlist, |
VacAttrStats ** | stats | ||
) |
Definition at line 621 of file mcv.c.
References Assert, VacAttrStats::attrcollid, VacAttrStats::attrtype, MCVItem::base_frequency, bsearch_arg(), compare_datums_simple(), compare_scalars_simple(), CurrentMemoryContext, DatumGetCString(), DatumGetPointer(), MCVItem::frequency, i, MCVItem::isnull, ITEM_SIZE, MCVList::items, len, lookup_type_cache(), TypeCacheEntry::lt_opr, MCVList::magic, MAXALIGN, DimensionInfo::nbytes, DimensionInfo::nbytes_aligned, MCVList::ndimensions, MCVList::nitems, DimensionInfo::nvalues, palloc0(), pfree(), PG_DETOAST_DATUM, PG_UINT16_MAX, PG_USED_FOR_ASSERTS_ONLY, PointerGetDatum(), PrepareSortSupportFromOrderingOp(), qsort_interruptible(), SET_VARSIZE, SortSupportData::ssup_collation, SortSupportData::ssup_cxt, SortSupportData::ssup_nulls_first, start, store_att_byval(), DimensionInfo::typbyval, MCVList::type, TYPECACHE_LT_OPR, MCVList::types, DimensionInfo::typlen, value, values, MCVItem::values, VARDATA, VARDATA_ANY, VARHDRSZ, and VARSIZE_ANY_EXHDR.
Referenced by statext_store().
MVNDistinct* statext_ndistinct_build | ( | double | totalrows, |
StatsBuildData * | data | ||
) |
Definition at line 88 of file mvdistinct.c.
References Assert, AttributeNumberIsValid, MVNDistinctItem::attributes, data, generator_free(), generator_init(), generator_next(), MVNDistinct::items, items, j, MVNDistinct::magic, MVNDistinctItem::nattributes, MVNDistinctItem::ndistinct, ndistinct_for_combination(), MVNDistinct::nitems, nitems, num_combinations(), palloc(), STATS_NDISTINCT_MAGIC, STATS_NDISTINCT_TYPE_BASIC, and MVNDistinct::type.
Referenced by BuildRelationExtStatistics().
MVNDistinct* statext_ndistinct_deserialize | ( | bytea * | data | ) |
Definition at line 250 of file mvdistinct.c.
References Assert, MVNDistinctItem::attributes, data, elog, ERROR, i, MVNDistinct::items, items, MVNDistinct::magic, MAXALIGN, MinSizeOfItems, MVNDistinctItem::nattributes, MVNDistinctItem::ndistinct, MVNDistinct::nitems, palloc(), palloc0(), SizeOfHeader, STATS_MAX_DIMENSIONS, STATS_NDISTINCT_MAGIC, STATS_NDISTINCT_TYPE_BASIC, MVNDistinct::type, VARDATA_ANY, VARSIZE_ANY, and VARSIZE_ANY_EXHDR.
Referenced by pg_ndistinct_out(), and statext_ndistinct_load().
bytea* statext_ndistinct_serialize | ( | MVNDistinct * | ndistinct | ) |
Definition at line 179 of file mvdistinct.c.
References Assert, MVNDistinctItem::attributes, i, MVNDistinct::items, len, MVNDistinct::magic, MVNDistinctItem::nattributes, MVNDistinctItem::ndistinct, MVNDistinct::nitems, output, palloc(), SET_VARSIZE, SizeOfHeader, SizeOfItem, STATS_NDISTINCT_MAGIC, STATS_NDISTINCT_TYPE_BASIC, MVNDistinct::type, VARDATA, and VARHDRSZ.
Referenced by statext_store().