]> granicus.if.org Git - postgresql/blob - src/include/catalog/pg_statistic.h
Ye-old pgindent run. Same 4-space tabs.
[postgresql] / src / include / catalog / pg_statistic.h
1 /*-------------------------------------------------------------------------
2  *
3  * pg_statistic.h
4  *        definition of the system "statistic" relation (pg_statistic)
5  *        along with the relation's initial contents.
6  *
7  *
8  * Portions Copyright (c) 1996-2000, PostgreSQL, Inc
9  * Portions Copyright (c) 1994, Regents of the University of California
10  *
11  * $Id: pg_statistic.h,v 1.9 2000/04/12 17:16:29 momjian Exp $
12  *
13  * NOTES
14  *        the genbki.sh script reads this file and generates .bki
15  *        information from the DATA() statements.
16  *
17  *-------------------------------------------------------------------------
18  */
19 #ifndef PG_STATISTIC_H
20 #define PG_STATISTIC_H
21
22 /* ----------------
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.
26  * ----------------
27  */
28
29 /* ----------------
30  *              pg_statistic definition.  cpp turns this into
31  *              typedef struct FormData_pg_statistic
32  * ----------------
33  */
34 CATALOG(pg_statistic)
35 {
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 */
40
41         /*
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
47          * NULL.
48          */
49
50         /*
51          * These fields contain the stats about the column indicated by the
52          * key
53          */
54         float4          stanullfrac;    /* the fraction of the entries that are
55                                                                  * NULL */
56         float4          stacommonfrac;  /* the fraction that are the most common
57                                                                  * val */
58
59         /*
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.
63          *
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)).
67          */
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;
72
73 /* ----------------
74  *              Form_pg_statistic corresponds to a pointer to a tuple with
75  *              the format of pg_statistic relation.
76  * ----------------
77  */
78 typedef FormData_pg_statistic *Form_pg_statistic;
79
80 /* ----------------
81  *              compiler constants for pg_statistic
82  * ----------------
83  */
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
93
94 #endif   /* PG_STATISTIC_H */