| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | #ifndef STATISTICS_H |
| | #define STATISTICS_H |
| |
|
| | #include "commands/vacuum.h" |
| | #include "nodes/pathnodes.h" |
| |
|
| | #define STATS_MAX_DIMENSIONS 8 |
| |
|
| | |
| | #define STATS_NDISTINCT_MAGIC 0xA352BFA4 |
| | #define STATS_NDISTINCT_TYPE_BASIC 1 |
| |
|
| | |
| | typedef struct MVNDistinctItem |
| | { |
| | double ndistinct; |
| | int nattributes; |
| | AttrNumber *attributes; |
| | } MVNDistinctItem; |
| |
|
| | |
| | typedef struct MVNDistinct |
| | { |
| | uint32 magic; |
| | uint32 type; |
| | uint32 nitems; |
| | MVNDistinctItem items[FLEXIBLE_ARRAY_MEMBER]; |
| | } MVNDistinct; |
| |
|
| | |
| | #define STATS_DEPS_MAGIC 0xB4549A2C |
| | #define STATS_DEPS_TYPE_BASIC 1 |
| |
|
| | |
| | |
| | |
| | |
| | typedef struct MVDependency |
| | { |
| | double degree; |
| | AttrNumber nattributes; |
| | AttrNumber attributes[FLEXIBLE_ARRAY_MEMBER]; |
| | } MVDependency; |
| |
|
| | typedef struct MVDependencies |
| | { |
| | uint32 magic; |
| | uint32 type; |
| | uint32 ndeps; |
| | MVDependency *deps[FLEXIBLE_ARRAY_MEMBER]; |
| | } MVDependencies; |
| |
|
| | |
| | #define STATS_MCV_MAGIC 0xE1A651C2 |
| | #define STATS_MCV_TYPE_BASIC 1 |
| |
|
| | |
| | #define STATS_MCVLIST_MAX_ITEMS MAX_STATISTICS_TARGET |
| |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | typedef struct MCVItem |
| | { |
| | double frequency; |
| | double base_frequency; |
| | bool *isnull; |
| | Datum *values; |
| | } MCVItem; |
| |
|
| | |
| | typedef struct MCVList |
| | { |
| | uint32 magic; |
| | uint32 type; |
| | uint32 nitems; |
| | AttrNumber ndimensions; |
| | Oid types[STATS_MAX_DIMENSIONS]; |
| | MCVItem items[FLEXIBLE_ARRAY_MEMBER]; |
| | } MCVList; |
| |
|
| | extern MVNDistinct *statext_ndistinct_load(Oid mvoid, bool inh); |
| | extern MVDependencies *statext_dependencies_load(Oid mvoid, bool inh); |
| | extern MCVList *statext_mcv_load(Oid mvoid, bool inh); |
| |
|
| | extern void BuildRelationExtStatistics(Relation onerel, bool inh, double totalrows, |
| | int numrows, HeapTuple *rows, |
| | int natts, VacAttrStats **vacattrstats); |
| | extern int ComputeExtStatisticsRows(Relation onerel, |
| | int natts, VacAttrStats **vacattrstats); |
| | extern bool statext_is_kind_built(HeapTuple htup, char type); |
| | extern Selectivity dependencies_clauselist_selectivity(PlannerInfo *root, |
| | List *clauses, |
| | int varRelid, |
| | JoinType jointype, |
| | SpecialJoinInfo *sjinfo, |
| | RelOptInfo *rel, |
| | Bitmapset **estimatedclauses); |
| | extern Selectivity statext_clauselist_selectivity(PlannerInfo *root, |
| | List *clauses, |
| | int varRelid, |
| | JoinType jointype, |
| | SpecialJoinInfo *sjinfo, |
| | RelOptInfo *rel, |
| | Bitmapset **estimatedclauses, |
| | bool is_or); |
| | extern bool has_stats_of_kind(List *stats, char requiredkind); |
| | extern StatisticExtInfo *choose_best_statistics(List *stats, char requiredkind, |
| | bool inh, |
| | Bitmapset **clause_attnums, |
| | List **clause_exprs, |
| | int nclauses); |
| | extern HeapTuple statext_expressions_load(Oid stxoid, bool inh, int idx); |
| |
|
| | #endif |
| |
|