postgresql/src/include/commands/vacuum.h

140 lines
2.9 KiB
C
Raw Normal View History

/*-------------------------------------------------------------------------
*
* vacuum.h
* header file for postgres vacuum cleaner
*
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: vacuum.h,v 1.25 2000/01/15 22:43:23 tgl Exp $
*
*-------------------------------------------------------------------------
*/
#ifndef VACUUM_H
#define VACUUM_H
#include "fmgr.h"
1997-11-26 02:26:13 +01:00
#include "access/funcindex.h"
#include "catalog/pg_index.h"
#include "catalog/pg_attribute.h"
#include "nodes/pg_list.h"
#include "storage/itemptr.h"
1997-02-07 17:24:12 +01:00
typedef struct VAttListData
{
int val_dummy;
struct VAttListData *val_next;
} VAttListData;
typedef VAttListData *VAttList;
typedef struct VPageDescrData
{
BlockNumber vpd_blkno; /* BlockNumber of this Page */
Size vpd_free; /* FreeSpace on this Page */
uint16 vpd_offsets_used; /* Number of OffNums used by
* vacuum */
uint16 vpd_offsets_free; /* Number of OffNums free or to be
* free */
OffsetNumber vpd_offsets[1];/* Array of its OffNums */
} VPageDescrData;
typedef VPageDescrData *VPageDescr;
typedef struct VPageListData
{
1998-08-19 21:59:49 +02:00
int vpl_empty_end_pages; /* Number of "empty" end-pages */
int vpl_num_pages; /* Number of pages in vpl_pagedesc */
int vpl_num_allocated_pages; /* Number of allocated pages in vpl_pagedesc */
1998-08-19 21:59:49 +02:00
VPageDescr *vpl_pagedesc; /* Descriptions of pages */
} VPageListData;
typedef VPageListData *VPageList;
typedef struct
{
FuncIndexInfo finfo;
FuncIndexInfo *finfoP;
1998-09-01 05:29:17 +02:00
Form_pg_index tform;
int natts;
} IndDesc;
typedef struct
{
1998-09-01 05:29:17 +02:00
Form_pg_attribute attr;
Datum best,
guess1,
guess2,
max,
min;
int best_len,
guess1_len,
guess2_len,
max_len,
min_len;
long best_cnt,
guess1_cnt,
guess1_hits,
guess2_hits,
null_cnt,
nonnull_cnt,
max_cnt,
min_cnt;
FmgrInfo f_cmpeq,
f_cmplt,
f_cmpgt;
Oid op_cmplt;
regproc outfunc;
Oid typelem;
bool initialized;
} VacAttrStats;
typedef struct VRelListData
{
Oid vrl_relid;
struct VRelListData *vrl_next;
} VRelListData;
typedef VRelListData *VRelList;
typedef struct VTupleLinkData
{
1999-05-25 18:15:34 +02:00
ItemPointerData new_tid;
ItemPointerData this_tid;
1999-05-26 00:43:53 +02:00
} VTupleLinkData;
typedef VTupleLinkData *VTupleLink;
typedef struct VTupleMoveData
{
1999-05-25 18:15:34 +02:00
ItemPointerData tid; /* tuple ID */
VPageDescr vpd; /* where to move */
bool cleanVpd; /* clean vpd before using */
1999-05-26 00:43:53 +02:00
} VTupleMoveData;
typedef VTupleMoveData *VTupleMove;
typedef struct VRelStats
{
1999-05-25 18:15:34 +02:00
Oid relid;
int num_tuples;
int num_pages;
Size min_tlen;
Size max_tlen;
bool hasindex;
int va_natts; /* number of attrs being analyzed */
VacAttrStats *vacattrstats;
int num_vtlinks;
VTupleLink vtlinks;
} VRelStats;
extern bool VacuumRunning;
extern void vc_abort(void);
extern void vacuum(char *vacrel, bool verbose, bool analyze, List *va_spec);
#define ATTNVALS_SCALE 1000000000 /* XXX so it can act as a float4 */
#endif /* VACUUM_H */