Alvaro Herrera wrote:
> Here I repost the patch to implement non-transactional catalogs, the
> first of which is pg_ntclass, intended to hold the non-transactional
> info about pg_class (reltuples, relpages).
I forgot to attach the new file pg_ntclass.h (src/include/catalog).
Here it is.
/*-------------------------------------------------------------------------
*
* pg_ntclass.h
* definition of the system "non transactional relation" relation
* (pg_ntclass) along with the relation's initial contents.
*
*
* Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $PostgreSQL$
*
* NOTES
* the genbki.sh script reads this file and generates .bki
* information from the DATA() statements.
*
*-------------------------------------------------------------------------
*/
#ifndef PG_NTCLASS_H
#define PG_NTCLASS_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.
* ----------------
*/
/* ----------------
* pg_ntclass definition. cpp turns this into
* typedef struct FormData_pg_class
* ----------------
*/
#define NtClassRelationId 1004
CATALOG(pg_ntclass,1004) BKI_BOOTSTRAP BKI_WITHOUT_OIDS
{
int4 relpages; /* # of blocks (not always up-to-date) */
float4 reltuples; /* # of tuples (not always up-to-date) */
} FormData_pg_ntclass;
/* Size of pg_ntclass tuples */
#define NTCLASS_TUPLE_SIZE \
(offsetof(FormData_pg_ntclass,reltuples) + sizeof(float4))
/* ----------------
* Form_pg_ntclass corresponds to a pointer to a tuple with
* the format of pg_ntclass relation.
* ----------------
*/
typedef FormData_pg_ntclass *Form_pg_ntclass;
/* ----------------
* compiler constants for pg_ntclass
* ----------------
*/
#define Natts_pg_ntclass 2
#define Anum_pg_ntclass_relpages 1
#define Anum_pg_ntclass_reltuples 2
/* ----------------
* initial contents of pg_ntclass
*
* NOTE: We need as many tuples here as bootstrapped relations there are
* declared in pg_class.
* ----------------
*/
DATA(insert ( 0 0 ));
DATA(insert ( 0 0 ));
DATA(insert ( 0 0 ));
DATA(insert ( 0 0 ));
DATA(insert ( 0 0 ));
#endif /* PG_NTCLASS_H */
---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend