Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit6fe0eb9

Browse files
committed
Add Cardinality typedef
Similar to Cost and Selectivity, this is just a double, which can beused in path and plan nodes to give some hint about the meaning of afield.Discussion:https://www.postgresql.org/message-id/c091e5cd-45f8-69ee-6a9b-de86912cc7e7@enterprisedb.com
1 parent1316be2 commit6fe0eb9

File tree

4 files changed

+27
-26
lines changed

4 files changed

+27
-26
lines changed

‎src/include/nodes/nodes.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -668,6 +668,7 @@ extern bool equal(const void *a, const void *b);
668668
*/
669669
typedefdoubleSelectivity;/* fraction of tuples a qualifier will pass */
670670
typedefdoubleCost;/* execution cost (in page-access units) */
671+
typedefdoubleCardinality;/* (estimated) number of rows or other integer count */
671672

672673

673674
/*

‎src/include/nodes/parsenodes.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1144,7 +1144,7 @@ typedef struct RangeTblEntry
11441144
* Fields valid for ENR RTEs (else NULL/zero):
11451145
*/
11461146
char*enrname;/* name of ephemeral named relation */
1147-
doubleenrtuples;/* estimated or actual from caller */
1147+
Cardinalityenrtuples;/* estimated or actual from caller */
11481148

11491149
/*
11501150
* Fields valid in all RTEs:

‎src/include/nodes/pathnodes.h

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -334,11 +334,11 @@ struct PlannerInfo
334334

335335
MemoryContextplanner_cxt;/* context holding PlannerInfo */
336336

337-
doubletotal_table_pages;/* # of pages in all non-dummy tables of
337+
Cardinalitytotal_table_pages;/* # of pages in all non-dummy tables of
338338
* query */
339339

340-
doubletuple_fraction;/* tuple_fraction passed to query_planner */
341-
doublelimit_tuples;/* limit_tuples passed to query_planner */
340+
Selectivitytuple_fraction;/* tuple_fraction passed to query_planner */
341+
Cardinalitylimit_tuples;/* limit_tuples passed to query_planner */
342342

343343
Indexqual_security_level;/* minimum security_level for quals */
344344
/* Note: qual_security_level is zero if there are no securityQuals */
@@ -681,7 +681,7 @@ typedef struct RelOptInfo
681681
Relidsrelids;/* set of base relids (rangetable indexes) */
682682

683683
/* size estimates generated by planner */
684-
doublerows;/* estimated number of result tuples */
684+
Cardinalityrows;/* estimated number of result tuples */
685685

686686
/* per-relation planner control flags */
687687
boolconsider_startup;/* keep cheap-startup-cost paths? */
@@ -718,7 +718,7 @@ typedef struct RelOptInfo
718718
List*indexlist;/* list of IndexOptInfo */
719719
List*statlist;/* list of StatisticExtInfo */
720720
BlockNumberpages;/* size estimates derived from pg_class */
721-
doubletuples;
721+
Cardinalitytuples;
722722
doubleallvisfrac;
723723
Bitmapset*eclass_indexes;/* Indexes in PlannerInfo's eq_classes list of
724724
* ECs that mention this rel */
@@ -841,7 +841,7 @@ struct IndexOptInfo
841841

842842
/* index-size statistics (from pg_class and elsewhere) */
843843
BlockNumberpages;/* number of disk pages in index */
844-
doubletuples;/* number of index tuples in index */
844+
Cardinalitytuples;/* number of index tuples in index */
845845
inttree_height;/* index tree height, or -1 if unknown */
846846

847847
/* index descriptor information */
@@ -1139,7 +1139,7 @@ typedef struct ParamPathInfo
11391139
NodeTagtype;
11401140

11411141
Relidsppi_req_outer;/* rels supplying parameters used by path */
1142-
doubleppi_rows;/* estimated number of result tuples */
1142+
Cardinalityppi_rows;/* estimated number of result tuples */
11431143
List*ppi_clauses;/* join clauses available from outer rels */
11441144
}ParamPathInfo;
11451145

@@ -1189,7 +1189,7 @@ typedef struct Path
11891189
intparallel_workers;/* desired # of workers; 0 = not parallel */
11901190

11911191
/* estimated size/costs for path (see costsize.c for more info) */
1192-
doublerows;/* estimated number of result tuples */
1192+
Cardinalityrows;/* estimated number of result tuples */
11931193
Coststartup_cost;/* cost expended before fetching any tuples */
11941194
Costtotal_cost;/* total cost (assuming all tuples fetched) */
11951195

@@ -1452,7 +1452,7 @@ typedef struct AppendPath
14521452
List*subpaths;/* list of component Paths */
14531453
/* Index of first partial path in subpaths; list_length(subpaths) if none */
14541454
intfirst_partial_path;
1455-
doublelimit_tuples;/* hard limit on output tuples, or -1 */
1455+
Cardinalitylimit_tuples;/* hard limit on output tuples, or -1 */
14561456
}AppendPath;
14571457

14581458
#defineIS_DUMMY_APPEND(p) \
@@ -1474,7 +1474,7 @@ typedef struct MergeAppendPath
14741474
{
14751475
Pathpath;
14761476
List*subpaths;/* list of component Paths */
1477-
doublelimit_tuples;/* hard limit on output tuples, or -1 */
1477+
Cardinalitylimit_tuples;/* hard limit on output tuples, or -1 */
14781478
}MergeAppendPath;
14791479

14801480
/*
@@ -1515,7 +1515,7 @@ typedef struct MemoizePath
15151515
List*param_exprs;/* cache keys */
15161516
boolsinglerow;/* true if the cache entry is to be marked as
15171517
* complete after caching the first record. */
1518-
doublecalls;/* expected number of rescans */
1518+
Cardinalitycalls;/* expected number of rescans */
15191519
uint32est_entries;/* The maximum number of entries that the
15201520
* planner expects will fit in the cache, or 0
15211521
* if unknown */
@@ -1667,7 +1667,7 @@ typedef struct HashPath
16671667
JoinPathjpath;
16681668
List*path_hashclauses;/* join clauses used for hashing */
16691669
intnum_batches;/* number of batches expected */
1670-
doubleinner_rows_total;/* total inner rows expected */
1670+
Cardinalityinner_rows_total;/* total inner rows expected */
16711671
}HashPath;
16721672

16731673
/*
@@ -1770,7 +1770,7 @@ typedef struct AggPath
17701770
Path*subpath;/* path representing input source */
17711771
AggStrategyaggstrategy;/* basic strategy, see nodes.h */
17721772
AggSplitaggsplit;/* agg-splitting mode, see nodes.h */
1773-
doublenumGroups;/* estimated number of groups in input */
1773+
CardinalitynumGroups;/* estimated number of groups in input */
17741774
uint64transitionSpace;/* for pass-by-ref transition data */
17751775
List*groupClause;/* a list of SortGroupClause's */
17761776
List*qual;/* quals (HAVING quals), if any */
@@ -1784,7 +1784,7 @@ typedef struct GroupingSetData
17841784
{
17851785
NodeTagtype;
17861786
List*set;/* grouping set as list of sortgrouprefs */
1787-
doublenumGroups;/* est. number of result groups */
1787+
CardinalitynumGroups;/* est. number of result groups */
17881788
}GroupingSetData;
17891789

17901790
typedefstructRollupData
@@ -1793,7 +1793,7 @@ typedef struct RollupData
17931793
List*groupClause;/* applicable subset of parse->groupClause */
17941794
List*gsets;/* lists of integer indexes into groupClause */
17951795
List*gsets_data;/* list of GroupingSetData */
1796-
doublenumGroups;/* est. number of result groups */
1796+
CardinalitynumGroups;/* est. number of result groups */
17971797
boolhashable;/* can be hashed */
17981798
boolis_hashed;/* to be implemented as a hashagg */
17991799
}RollupData;
@@ -1844,7 +1844,7 @@ typedef struct SetOpPath
18441844
List*distinctList;/* SortGroupClauses identifying target cols */
18451845
AttrNumberflagColIdx;/* where is the flag column, if any */
18461846
intfirstFlag;/* flag value for first input relation */
1847-
doublenumGroups;/* estimated number of groups in input */
1847+
CardinalitynumGroups;/* estimated number of groups in input */
18481848
}SetOpPath;
18491849

18501850
/*
@@ -1857,7 +1857,7 @@ typedef struct RecursiveUnionPath
18571857
Path*rightpath;
18581858
List*distinctList;/* SortGroupClauses identifying target cols */
18591859
intwtParam;/* ID of Param representing work table */
1860-
doublenumGroups;/* estimated number of groups in input */
1860+
CardinalitynumGroups;/* estimated number of groups in input */
18611861
}RecursiveUnionPath;
18621862

18631863
/*
@@ -2612,7 +2612,7 @@ typedef struct
26122612
typedefstruct
26132613
{
26142614
boollimit_needed;
2615-
doublelimit_tuples;
2615+
Cardinalitylimit_tuples;
26162616
int64count_est;
26172617
int64offset_est;
26182618
}FinalPathExtraData;
@@ -2643,15 +2643,15 @@ typedef struct JoinCostWorkspace
26432643
Costinner_rescan_run_cost;
26442644

26452645
/* private for cost_mergejoin code */
2646-
doubleouter_rows;
2647-
doubleinner_rows;
2648-
doubleouter_skip_rows;
2649-
doubleinner_skip_rows;
2646+
Cardinalityouter_rows;
2647+
Cardinalityinner_rows;
2648+
Cardinalityouter_skip_rows;
2649+
Cardinalityinner_skip_rows;
26502650

26512651
/* private for cost_hashjoin code */
26522652
intnumbuckets;
26532653
intnumbatches;
2654-
doubleinner_rows_total;
2654+
Cardinalityinner_rows_total;
26552655
}JoinCostWorkspace;
26562656

26572657
/*

‎src/include/nodes/plannodes.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ typedef struct Plan
120120
/*
121121
* planner's estimate of result size of this plan step
122122
*/
123-
doubleplan_rows;/* number of rows plan is expected to emit */
123+
Cardinalityplan_rows;/* number of rows plan is expected to emit */
124124
intplan_width;/* average row width in bytes */
125125

126126
/*
@@ -976,7 +976,7 @@ typedef struct Hash
976976
AttrNumberskewColumn;/* outer join key's column #, or zero */
977977
boolskewInherit;/* is outer join rel an inheritance tree? */
978978
/* all other info is in the parent HashJoin node */
979-
doublerows_total;/* estimate total rows if parallel_aware */
979+
Cardinalityrows_total;/* estimate total rows if parallel_aware */
980980
}Hash;
981981

982982
/* ----------------

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp