summaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2009-12-29 20:11:45 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2009-12-29 20:11:45 +0000
commit649b5ec7c8a3050a30bd6d36003ba3a681c9a198 (patch)
treeaf041b646426d71d9ea1113837b5f7a9001082c9 /src/include
parent84d723b6cefcf25b8c800f8aa6cf3c9538a546b4 (diff)
Add the ability to store inheritance-tree statistics in pg_statistic,
and teach ANALYZE to compute such stats for tables that have subclasses. Per my proposal of yesterday. autovacuum still needs to be taught about running ANALYZE on parent tables when their subclasses change, but the feature is useful even without that.
Diffstat (limited to 'src/include')
-rw-r--r--src/include/catalog/catversion.h4
-rw-r--r--src/include/catalog/indexing.h6
-rw-r--r--src/include/catalog/pg_statistic.h44
-rw-r--r--src/include/nodes/plannodes.h9
-rw-r--r--src/include/utils/syscache.h4
5 files changed, 35 insertions, 32 deletions
diff --git a/src/include/catalog/catversion.h b/src/include/catalog/catversion.h
index 6ac2c6713d8..0c4ce005295 100644
--- a/src/include/catalog/catversion.h
+++ b/src/include/catalog/catversion.h
@@ -37,7 +37,7 @@
* Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/catalog/catversion.h,v 1.561 2009/12/27 14:50:46 momjian Exp $
+ * $PostgreSQL: pgsql/src/include/catalog/catversion.h,v 1.562 2009/12/29 20:11:45 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -53,6 +53,6 @@
*/
/* yyyymmddN */
-#define CATALOG_VERSION_NO 200912271
+#define CATALOG_VERSION_NO 200912281
#endif
diff --git a/src/include/catalog/indexing.h b/src/include/catalog/indexing.h
index 3bf606c0985..a5d93ed4455 100644
--- a/src/include/catalog/indexing.h
+++ b/src/include/catalog/indexing.h
@@ -8,7 +8,7 @@
* Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/catalog/indexing.h,v 1.111 2009/12/11 03:34:56 itagaki Exp $
+ * $PostgreSQL: pgsql/src/include/catalog/indexing.h,v 1.112 2009/12/29 20:11:45 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -208,8 +208,8 @@ DECLARE_INDEX(pg_shdepend_depender_index, 1232, on pg_shdepend using btree(dbid
DECLARE_INDEX(pg_shdepend_reference_index, 1233, on pg_shdepend using btree(refclassid oid_ops, refobjid oid_ops));
#define SharedDependReferenceIndexId 1233
-DECLARE_UNIQUE_INDEX(pg_statistic_relid_att_index, 2696, on pg_statistic using btree(starelid oid_ops, staattnum int2_ops));
-#define StatisticRelidAttnumIndexId 2696
+DECLARE_UNIQUE_INDEX(pg_statistic_relid_att_inh_index, 2696, on pg_statistic using btree(starelid oid_ops, staattnum int2_ops, stainherit bool_ops));
+#define StatisticRelidAttnumInhIndexId 2696
DECLARE_UNIQUE_INDEX(pg_tablespace_oid_index, 2697, on pg_tablespace using btree(oid oid_ops));
#define TablespaceOidIndexId 2697
diff --git a/src/include/catalog/pg_statistic.h b/src/include/catalog/pg_statistic.h
index 0e831ef2982..8063f74190d 100644
--- a/src/include/catalog/pg_statistic.h
+++ b/src/include/catalog/pg_statistic.h
@@ -8,7 +8,7 @@
* Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/catalog/pg_statistic.h,v 1.39 2009/06/11 14:49:10 momjian Exp $
+ * $PostgreSQL: pgsql/src/include/catalog/pg_statistic.h,v 1.40 2009/12/29 20:11:45 tgl Exp $
*
* NOTES
* the genbki.sh script reads this file and generates .bki
@@ -43,6 +43,7 @@ CATALOG(pg_statistic,2619) BKI_WITHOUT_OIDS
/* These fields form the unique key for the entry: */
Oid starelid; /* relation containing attribute */
int2 staattnum; /* attribute (column) stats are for */
+ bool stainherit; /* true if inheritance children are included */
/* the fraction of the column's entries that are NULL: */
float4 stanullfrac;
@@ -142,28 +143,29 @@ typedef FormData_pg_statistic *Form_pg_statistic;
* compiler constants for pg_statistic
* ----------------
*/
-#define Natts_pg_statistic 21
+#define Natts_pg_statistic 22
#define Anum_pg_statistic_starelid 1
#define Anum_pg_statistic_staattnum 2
-#define Anum_pg_statistic_stanullfrac 3
-#define Anum_pg_statistic_stawidth 4
-#define Anum_pg_statistic_stadistinct 5
-#define Anum_pg_statistic_stakind1 6
-#define Anum_pg_statistic_stakind2 7
-#define Anum_pg_statistic_stakind3 8
-#define Anum_pg_statistic_stakind4 9
-#define Anum_pg_statistic_staop1 10
-#define Anum_pg_statistic_staop2 11
-#define Anum_pg_statistic_staop3 12
-#define Anum_pg_statistic_staop4 13
-#define Anum_pg_statistic_stanumbers1 14
-#define Anum_pg_statistic_stanumbers2 15
-#define Anum_pg_statistic_stanumbers3 16
-#define Anum_pg_statistic_stanumbers4 17
-#define Anum_pg_statistic_stavalues1 18
-#define Anum_pg_statistic_stavalues2 19
-#define Anum_pg_statistic_stavalues3 20
-#define Anum_pg_statistic_stavalues4 21
+#define Anum_pg_statistic_stainherit 3
+#define Anum_pg_statistic_stanullfrac 4
+#define Anum_pg_statistic_stawidth 5
+#define Anum_pg_statistic_stadistinct 6
+#define Anum_pg_statistic_stakind1 7
+#define Anum_pg_statistic_stakind2 8
+#define Anum_pg_statistic_stakind3 9
+#define Anum_pg_statistic_stakind4 10
+#define Anum_pg_statistic_staop1 11
+#define Anum_pg_statistic_staop2 12
+#define Anum_pg_statistic_staop3 13
+#define Anum_pg_statistic_staop4 14
+#define Anum_pg_statistic_stanumbers1 15
+#define Anum_pg_statistic_stanumbers2 16
+#define Anum_pg_statistic_stanumbers3 17
+#define Anum_pg_statistic_stanumbers4 18
+#define Anum_pg_statistic_stavalues1 19
+#define Anum_pg_statistic_stavalues2 20
+#define Anum_pg_statistic_stavalues3 21
+#define Anum_pg_statistic_stavalues4 22
/*
* Currently, three statistical slot "kinds" are defined: most common values,
diff --git a/src/include/nodes/plannodes.h b/src/include/nodes/plannodes.h
index e9c994e4f27..68c95d5cf8a 100644
--- a/src/include/nodes/plannodes.h
+++ b/src/include/nodes/plannodes.h
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/nodes/plannodes.h,v 1.113 2009/10/26 02:26:42 tgl Exp $
+ * $PostgreSQL: pgsql/src/include/nodes/plannodes.h,v 1.114 2009/12/29 20:11:45 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -570,9 +570,9 @@ typedef struct Unique
* hash build node
*
* If the executor is supposed to try to apply skew join optimization, then
- * skewTable/skewColumn identify the outer relation's join key column, from
- * which the relevant MCV statistics can be fetched. Also, its type
- * information is provided to save a lookup.
+ * skewTable/skewColumn/skewInherit identify the outer relation's join key
+ * column, from which the relevant MCV statistics can be fetched. Also, its
+ * type information is provided to save a lookup.
* ----------------
*/
typedef struct Hash
@@ -580,6 +580,7 @@ typedef struct Hash
Plan plan;
Oid skewTable; /* outer join key's table OID, or InvalidOid */
AttrNumber skewColumn; /* outer join key's column #, or zero */
+ bool skewInherit; /* is outer join rel an inheritance tree? */
Oid skewColType; /* datatype of the outer key column */
int32 skewColTypmod; /* typmod of the outer key column */
/* all other info is in the parent HashJoin node */
diff --git a/src/include/utils/syscache.h b/src/include/utils/syscache.h
index f0647e34194..d2d02236c78 100644
--- a/src/include/utils/syscache.h
+++ b/src/include/utils/syscache.h
@@ -9,7 +9,7 @@
* Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/utils/syscache.h,v 1.75 2009/10/05 19:24:49 tgl Exp $
+ * $PostgreSQL: pgsql/src/include/utils/syscache.h,v 1.76 2009/12/29 20:11:45 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -70,7 +70,7 @@ enum SysCacheIdentifier
RELNAMENSP,
RELOID,
RULERELNAME,
- STATRELATT,
+ STATRELATTINH,
TSCONFIGMAP,
TSCONFIGNAMENSP,
TSCONFIGOID,