1996-08-28 03:59:28 +02:00
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
*
|
1999-02-14 00:22:53 +01:00
|
|
|
* pg_statistic.h
|
1997-09-07 07:04:48 +02:00
|
|
|
* definition of the system "statistic" relation (pg_statistic)
|
|
|
|
* along with the relation's initial contents.
|
1996-08-28 03:59:28 +02:00
|
|
|
*
|
|
|
|
*
|
2001-01-24 20:43:33 +01:00
|
|
|
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
|
2000-01-26 06:58:53 +01:00
|
|
|
* Portions Copyright (c) 1994, Regents of the University of California
|
1996-08-28 03:59:28 +02:00
|
|
|
*
|
2001-01-24 20:43:33 +01:00
|
|
|
* $Id: pg_statistic.h,v 1.10 2001/01/24 19:43:22 momjian Exp $
|
1996-08-28 03:59:28 +02:00
|
|
|
*
|
|
|
|
* NOTES
|
1997-09-07 07:04:48 +02:00
|
|
|
* the genbki.sh script reads this file and generates .bki
|
|
|
|
* information from the DATA() statements.
|
1996-08-28 03:59:28 +02:00
|
|
|
*
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
#ifndef PG_STATISTIC_H
|
|
|
|
#define PG_STATISTIC_H
|
|
|
|
|
|
|
|
/* ----------------
|
1997-09-07 07:04:48 +02:00
|
|
|
* postgres.h contains the system type definintions and the
|
|
|
|
* CATALOG(), BOOTSTRAP and DATA() sugar words so this file
|
|
|
|
* can be read by both genbki.sh and the C compiler.
|
1996-08-28 03:59:28 +02:00
|
|
|
* ----------------
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* ----------------
|
1997-09-07 07:04:48 +02:00
|
|
|
* pg_statistic definition. cpp turns this into
|
|
|
|
* typedef struct FormData_pg_statistic
|
1996-08-28 03:59:28 +02:00
|
|
|
* ----------------
|
1997-09-07 07:04:48 +02:00
|
|
|
*/
|
|
|
|
CATALOG(pg_statistic)
|
|
|
|
{
|
1999-08-01 06:54:25 +02:00
|
|
|
/* These fields form the unique key for the entry: */
|
|
|
|
Oid starelid; /* relation containing attribute */
|
|
|
|
int2 staattnum; /* attribute (column) stats are for */
|
|
|
|
Oid staop; /* '<' comparison op used for lo/hi vals */
|
2000-04-12 19:17:23 +02:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Note: the current VACUUM code will never produce more than one
|
|
|
|
* entry per column, but in theory there could be multiple entries if
|
|
|
|
* a datatype has more than one useful ordering operator. Also, the
|
|
|
|
* current code will not write an entry unless it found at least one
|
|
|
|
* non-NULL value in the column; so the remaining fields will never be
|
|
|
|
* NULL.
|
1999-08-01 06:54:25 +02:00
|
|
|
*/
|
|
|
|
|
2000-04-12 19:17:23 +02:00
|
|
|
/*
|
|
|
|
* These fields contain the stats about the column indicated by the
|
|
|
|
* key
|
|
|
|
*/
|
|
|
|
float4 stanullfrac; /* the fraction of the entries that are
|
|
|
|
* NULL */
|
|
|
|
float4 stacommonfrac; /* the fraction that are the most common
|
|
|
|
* val */
|
1999-08-01 06:54:25 +02:00
|
|
|
|
2000-04-12 19:17:23 +02:00
|
|
|
/*
|
|
|
|
* THE REST OF THESE ARE VARIABLE LENGTH FIELDS. They cannot be
|
|
|
|
* accessed as C struct entries; you have to use the full field access
|
|
|
|
* machinery (heap_getattr) for them.
|
1999-08-01 06:54:25 +02:00
|
|
|
*
|
|
|
|
* All three of these are text representations of data values of the
|
|
|
|
* column's data type. To re-create the actual Datum, do
|
|
|
|
* datatypein(textout(givenvalue)).
|
|
|
|
*/
|
|
|
|
text stacommonval; /* most common non-null value in column */
|
|
|
|
text staloval; /* smallest non-null value in column */
|
|
|
|
text stahival; /* largest non-null value in column */
|
1996-08-28 03:59:28 +02:00
|
|
|
} FormData_pg_statistic;
|
|
|
|
|
|
|
|
/* ----------------
|
1997-09-07 07:04:48 +02:00
|
|
|
* Form_pg_statistic corresponds to a pointer to a tuple with
|
|
|
|
* the format of pg_statistic relation.
|
1996-08-28 03:59:28 +02:00
|
|
|
* ----------------
|
|
|
|
*/
|
1997-09-07 07:04:48 +02:00
|
|
|
typedef FormData_pg_statistic *Form_pg_statistic;
|
1996-08-28 03:59:28 +02:00
|
|
|
|
|
|
|
/* ----------------
|
1997-09-07 07:04:48 +02:00
|
|
|
* compiler constants for pg_statistic
|
1996-08-28 03:59:28 +02:00
|
|
|
* ----------------
|
|
|
|
*/
|
1999-08-01 06:54:25 +02:00
|
|
|
#define Natts_pg_statistic 8
|
1997-09-07 07:04:48 +02:00
|
|
|
#define Anum_pg_statistic_starelid 1
|
|
|
|
#define Anum_pg_statistic_staattnum 2
|
|
|
|
#define Anum_pg_statistic_staop 3
|
1999-08-01 06:54:25 +02:00
|
|
|
#define Anum_pg_statistic_stanullfrac 4
|
2000-04-12 19:17:23 +02:00
|
|
|
#define Anum_pg_statistic_stacommonfrac 5
|
1999-08-01 06:54:25 +02:00
|
|
|
#define Anum_pg_statistic_stacommonval 6
|
|
|
|
#define Anum_pg_statistic_staloval 7
|
|
|
|
#define Anum_pg_statistic_stahival 8
|
1996-08-28 03:59:28 +02:00
|
|
|
|
1998-09-01 06:40:42 +02:00
|
|
|
#endif /* PG_STATISTIC_H */
|