]> granicus.if.org Git - postgresql/blobdiff - src/include/catalog/pg_statistic.h
Create a type-specific typanalyze routine for tsvector, which collects stats
[postgresql] / src / include / catalog / pg_statistic.h
index 209180848e6a5f89727c8eb2c6704071980781ae..0ca66edd7f8c9c48b30f422fdfbd9de527868df2 100644 (file)
@@ -5,10 +5,10 @@
  *       along with the relation's initial contents.
  *
  *
- * Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $PostgreSQL: pgsql/src/include/catalog/pg_statistic.h,v 1.31 2006/03/05 15:58:55 momjian Exp $
+ * $PostgreSQL: pgsql/src/include/catalog/pg_statistic.h,v 1.36 2008/07/14 00:51:45 tgl Exp $
  *
  * NOTES
  *       the genbki.sh script reads this file and generates .bki
 #ifndef PG_STATISTIC_H
 #define PG_STATISTIC_H
 
-/* ----------------
- *             postgres.h contains the system type definitions and the
- *             CATALOG(), BKI_BOOTSTRAP and DATA() sugar words so this file
- *             can be read by both genbki.sh and the C compiler.
- * ----------------
- */
+#include "catalog/genbki.h"
 
 /*
- * Keep C compiler happy with anyarray, below. This will need to go elsewhere
- * if we ever use anyarray for more than pg_statistic.
+ * The CATALOG definition has to refer to the type of stavaluesN as
+ * "anyarray" so that bootstrap mode recognizes it.  There is no real
+ * typedef for that, however.  Since the fields are potentially-null and
+ * therefore can't be accessed directly from C code, there is no particular
+ * need for the C struct definition to show a valid field type --- instead
+ * we just make it int.
  */
-typedef struct varlena anyarray;
+#define anyarray int
 
 /* ----------------
  *             pg_statistic definition.  cpp turns this into
@@ -129,6 +128,9 @@ CATALOG(pg_statistic,2619) BKI_WITHOUT_OIDS
 
 #define STATISTIC_NUM_SLOTS  4
 
+#undef anyarray
+
+
 /* ----------------
  *             Form_pg_statistic corresponds to a pointer to a tuple with
  *             the format of pg_statistic relation.
@@ -184,7 +186,9 @@ typedef FormData_pg_statistic *Form_pg_statistic;
  *                             (values in this range will be documented in this file)
  *     100-199:        reserved for assignment by the PostGIS project
  *                             (values to be documented in PostGIS documentation)
- *     200-9999:       reserved for future public assignments
+ *     200-299:        reserved for assignment by the ESRI ST_Geometry project
+ *                             (values to be documented in ESRI ST_Geometry documentation)
+ *     300-9999:       reserved for future public assignments
  *
  * For private use you may choose a "kind" code at random in the range
  * 10000-30000.  However, for code that is to be widely disseminated it is
@@ -233,4 +237,19 @@ typedef FormData_pg_statistic *Form_pg_statistic;
  */
 #define STATISTIC_KIND_CORRELATION     3
 
+/*
+ * A "most common elements" slot is similar to a "most common values" slot,
+ * except that it stores the most common non-null *elements* of the column
+ * values.  This is useful when the column datatype is an array or some other
+ * type with identifiable elements (for instance, tsvector).  staop contains
+ * the equality operator appropriate to the element type.  stavalues contains
+ * the most common element values, and stanumbers their frequencies, with the
+ * same rules as for MCV slots.
+ *
+ * Note: in current usage for tsvector columns, the stavalues elements are of
+ * type text, even though their representation within tsvector is not
+ * exactly text.
+ */
+#define STATISTIC_KIND_MCELEM  4
+
 #endif   /* PG_STATISTIC_H */