1 /*-------------------------------------------------------------------------
4 * definition of the system "statistic" relation (pg_statistic)
5 * along with the relation's initial contents.
8 * Portions Copyright (c) 1996-2000, PostgreSQL, Inc
9 * Portions Copyright (c) 1994, Regents of the University of California
11 * $Id: pg_statistic.h,v 1.9 2000/04/12 17:16:29 momjian Exp $
14 * the genbki.sh script reads this file and generates .bki
15 * information from the DATA() statements.
17 *-------------------------------------------------------------------------
19 #ifndef PG_STATISTIC_H
20 #define PG_STATISTIC_H
23 * postgres.h contains the system type definintions and the
24 * CATALOG(), BOOTSTRAP and DATA() sugar words so this file
25 * can be read by both genbki.sh and the C compiler.
30 * pg_statistic definition. cpp turns this into
31 * typedef struct FormData_pg_statistic
36 /* These fields form the unique key for the entry: */
37 Oid starelid; /* relation containing attribute */
38 int2 staattnum; /* attribute (column) stats are for */
39 Oid staop; /* '<' comparison op used for lo/hi vals */
42 * Note: the current VACUUM code will never produce more than one
43 * entry per column, but in theory there could be multiple entries if
44 * a datatype has more than one useful ordering operator. Also, the
45 * current code will not write an entry unless it found at least one
46 * non-NULL value in the column; so the remaining fields will never be
51 * These fields contain the stats about the column indicated by the
54 float4 stanullfrac; /* the fraction of the entries that are
56 float4 stacommonfrac; /* the fraction that are the most common
60 * THE REST OF THESE ARE VARIABLE LENGTH FIELDS. They cannot be
61 * accessed as C struct entries; you have to use the full field access
62 * machinery (heap_getattr) for them.
64 * All three of these are text representations of data values of the
65 * column's data type. To re-create the actual Datum, do
66 * datatypein(textout(givenvalue)).
68 text stacommonval; /* most common non-null value in column */
69 text staloval; /* smallest non-null value in column */
70 text stahival; /* largest non-null value in column */
71 } FormData_pg_statistic;
74 * Form_pg_statistic corresponds to a pointer to a tuple with
75 * the format of pg_statistic relation.
78 typedef FormData_pg_statistic *Form_pg_statistic;
81 * compiler constants for pg_statistic
84 #define Natts_pg_statistic 8
85 #define Anum_pg_statistic_starelid 1
86 #define Anum_pg_statistic_staattnum 2
87 #define Anum_pg_statistic_staop 3
88 #define Anum_pg_statistic_stanullfrac 4
89 #define Anum_pg_statistic_stacommonfrac 5
90 #define Anum_pg_statistic_stacommonval 6
91 #define Anum_pg_statistic_staloval 7
92 #define Anum_pg_statistic_stahival 8
94 #endif /* PG_STATISTIC_H */