PostgreSQL Source Code
git master
|
#include "postgres.h"
#include "access/htup_details.h"
#include "catalog/pg_statistic_ext.h"
#include "catalog/pg_statistic_ext_data.h"
#include "lib/stringinfo.h"
#include "nodes/nodeFuncs.h"
#include "nodes/nodes.h"
#include "nodes/pathnodes.h"
#include "optimizer/clauses.h"
#include "optimizer/optimizer.h"
#include "parser/parsetree.h"
#include "statistics/extended_stats_internal.h"
#include "statistics/statistics.h"
#include "utils/fmgroids.h"
#include "utils/fmgrprotos.h"
#include "utils/lsyscache.h"
#include "utils/memutils.h"
#include "utils/selfuncs.h"
#include "utils/syscache.h"
#include "utils/typcache.h"
#include "varatt.h"
Go to the source code of this file.
Data Structures | |
struct | DependencyGeneratorData |
Macros | |
#define | SizeOfHeader (3 * sizeof(uint32)) |
#define | SizeOfItem(natts) (sizeof(double) + sizeof(AttrNumber) * (1 + (natts))) |
#define | MinSizeOfItem SizeOfItem(2) |
#define | MinSizeOfItems(ndeps) (SizeOfHeader + (ndeps) * MinSizeOfItem) |
Typedefs | |
typedef struct DependencyGeneratorData | DependencyGeneratorData |
typedef DependencyGeneratorData * | DependencyGenerator |
#define MinSizeOfItem SizeOfItem(2) |
Definition at line 45 of file dependencies.c.
#define MinSizeOfItems | ( | ndeps | ) | (SizeOfHeader + (ndeps) * MinSizeOfItem) |
Definition at line 48 of file dependencies.c.
#define SizeOfHeader (3 * sizeof(uint32)) |
Definition at line 38 of file dependencies.c.
#define SizeOfItem | ( | natts | ) | (sizeof(double) + sizeof(AttrNumber) * (1 + (natts))) |
Definition at line 41 of file dependencies.c.
Definition at line 65 of file dependencies.c.
typedef struct DependencyGeneratorData DependencyGeneratorData |
|
static |
Definition at line 1014 of file dependencies.c.
References attnum, MVDependency::attributes, bms_add_member(), bms_free(), bms_member_index(), bms_next_member(), bms_num_members(), CLAMP_PROBABILITY, clauselist_selectivity_ext(), MVDependency::degree, i, j, lappend(), lfirst, MVDependency::nattributes, NIL, palloc(), pfree(), root, s1, and s2.
Referenced by dependencies_clauselist_selectivity().
Selectivity dependencies_clauselist_selectivity | ( | PlannerInfo * | root, |
List * | clauses, | ||
int | varRelid, | ||
JoinType | jointype, | ||
SpecialJoinInfo * | sjinfo, | ||
RelOptInfo * | rel, | ||
Bitmapset ** | estimatedclauses | ||
) |
Definition at line 1370 of file dependencies.c.
References Assert, attnum, AttributeNumberIsValid, MVDependency::attributes, AttrNumberIsForUserDefinedAttr, bms_add_member(), bms_del_member(), bms_free(), bms_is_member(), bms_membership(), BMS_MULTIPLE, bms_next_member(), clauselist_apply_dependencies(), dependency_is_compatible_clause(), dependency_is_compatible_expression(), MVDependencies::deps, equal(), find_strongest_dependency(), has_stats_of_kind(), i, idx(), RangeTblEntry::inh, InvalidAttrNumber, j, lfirst, list_length(), list_nth(), MaxHeapAttributeNumber, MVDependency::nattributes, MVDependencies::ndeps, NIL, palloc(), pfree(), planner_rt_fetch, RelOptInfo::relid, root, s1, skip, statext_dependencies_load(), and RelOptInfo::statlist.
Referenced by statext_clauselist_selectivity().
|
static |
Definition at line 221 of file dependencies.c.
References Assert, VacAttrStats::attrcollid, VacAttrStats::attrtypid, build_sorted_items(), data, elog, ERROR, for(), i, InvalidOid, items, lookup_type_cache(), multi_sort_add_dimension(), multi_sort_compare_dim(), multi_sort_compare_dims(), multi_sort_init(), nitems, palloc(), type, and TYPECACHE_LT_OPR.
Referenced by statext_dependencies_build().
|
static |
Definition at line 741 of file dependencies.c.
References OpExpr::args, ScalarArrayOpExpr::args, BoolExpr::args, attnum, AttrNumberIsForUserDefinedAttr, bms_membership(), BMS_SINGLETON, RestrictInfo::clause, get_notclausearg(), get_oprrest(), InvalidAttrNumber, is_notclause(), is_opclause(), is_orclause(), is_pseudo_constant_clause(), IsA, lfirst, linitial, list_length(), lsecond, OpExpr::opno, ScalarArrayOpExpr::opno, ScalarArrayOpExpr::useOr, Var::varattno, Var::varlevelsup, and Var::varno.
Referenced by dependencies_clauselist_selectivity().
|
static |
Definition at line 1168 of file dependencies.c.
References OpExpr::args, ScalarArrayOpExpr::args, BoolExpr::args, bms_membership(), BMS_SINGLETON, RestrictInfo::clause, equal(), StatisticExtInfo::exprs, get_notclausearg(), get_oprrest(), is_notclause(), is_opclause(), is_orclause(), is_pseudo_constant_clause(), IsA, StatisticExtInfo::kind, lfirst, linitial, list_length(), lsecond, OpExpr::opno, ScalarArrayOpExpr::opno, and ScalarArrayOpExpr::useOr.
Referenced by dependencies_clauselist_selectivity().
|
static |
Definition at line 595 of file dependencies.c.
References attnum, MVDependency::attributes, bms_is_member(), j, and MVDependency::nattributes.
Referenced by find_strongest_dependency().
|
static |
Definition at line 196 of file dependencies.c.
References pfree().
Referenced by statext_dependencies_build().
|
static |
Definition at line 173 of file dependencies.c.
References Assert, generate_dependencies(), palloc(), and palloc0().
Referenced by statext_dependencies_build().
|
static |
|
static |
Definition at line 929 of file dependencies.c.
References bms_num_members(), MVDependency::degree, dependency_is_fully_matched(), MVDependencies::deps, i, j, MVDependency::nattributes, and MVDependencies::ndeps.
Referenced by dependencies_clauselist_selectivity().
|
static |
Definition at line 157 of file dependencies.c.
References generate_dependencies_recurse(), palloc0(), and pfree().
Referenced by DependencyGenerator_init().
|
static |
Definition at line 91 of file dependencies.c.
References i, j, repalloc(), and start.
Referenced by generate_dependencies().
Datum pg_dependencies_in | ( | PG_FUNCTION_ARGS | ) |
Definition at line 653 of file dependencies.c.
References ereport, errcode(), errmsg(), ERROR, and PG_RETURN_VOID.
Datum pg_dependencies_out | ( | PG_FUNCTION_ARGS | ) |
Definition at line 670 of file dependencies.c.
References appendStringInfo(), appendStringInfoChar(), appendStringInfoString(), MVDependency::attributes, data, MVDependency::degree, MVDependencies::deps, i, initStringInfo(), j, MVDependency::nattributes, MVDependencies::ndeps, PG_GETARG_BYTEA_PP, PG_RETURN_CSTRING, statext_dependencies_deserialize(), and str.
Datum pg_dependencies_recv | ( | PG_FUNCTION_ARGS | ) |
Definition at line 710 of file dependencies.c.
References ereport, errcode(), errmsg(), ERROR, and PG_RETURN_VOID.
Datum pg_dependencies_send | ( | PG_FUNCTION_ARGS | ) |
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().
MVDependencies* statext_dependencies_load | ( | Oid | mvoid, |
bool | inh | ||
) |
Definition at line 619 of file dependencies.c.
References BoolGetDatum(), DatumGetByteaPP, elog, ERROR, HeapTupleIsValid, ObjectIdGetDatum(), ReleaseSysCache(), SearchSysCache2(), statext_dependencies_deserialize(), and SysCacheGetAttr().
Referenced by dependencies_clauselist_selectivity().
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().