/* Individual heap tuple to be visited */ typedefstruct GISTSearchHeapItem
{
ItemPointerData heapPtr; bool recheck; /* T if quals must be rechecked */ bool recheckDistances; /* T if distances must be rechecked */
HeapTuple recontup; /* data reconstructed from the index, used in
* index-only scans */
OffsetNumber offnum; /* track offset in page to mark tuple as
* LP_DEAD */
} GISTSearchHeapItem;
/* Unvisited item, either index page or heap tuple */ typedefstruct GISTSearchItem
{
pairingheap_node phNode;
BlockNumber blkno; /* index page number, or InvalidBlockNumber */ union
{
GistNSN parentlsn; /* parent page's LSN, if index page */ /* we must store parentlsn to detect whether a split occurred */
GISTSearchHeapItem heap; /* heap info, if heap tuple */
} data;
/* *GISTScanOpaqueData:privatestateforascanofaGiSTindex
*/ typedefstruct GISTScanOpaqueData
{
GISTSTATE *giststate; /* index information, see above */
Oid *orderByTypes; /* datatypes of ORDER BY expressions */
pairingheap *queue; /* queue of unvisited items */
MemoryContext queueCxt; /* context holding the queue */ bool qual_ok; /* false if qual can never be satisfied */ bool firstCall; /* true until first gistgettuple call */
/* pre-allocated workspace arrays */
IndexOrderByDistance *distances; /* output area for gistindex_keytest */
/* info about killed items if any (killedItems is NULL if never used) */
OffsetNumber *killedItems; /* offset numbers of killed items */ int numKilled; /* number of currently stored items */
BlockNumber curBlkno; /* current number of block */
GistNSN curPageLSN; /* pos in the WAL stream when page was read */
/* In a non-ordered search, returnable heap items are stored here: */
GISTSearchHeapItem pageData[BLCKSZ / sizeof(IndexTupleData)];
OffsetNumber nPageData; /* number of valid items in array */
OffsetNumber curPageData; /* next item to return */
MemoryContext pageDataCxt; /* context holding the fetched tuples, for
* index-only scans */
} GISTScanOpaqueData;
typedef GISTScanOpaqueData *GISTScanOpaque;
/* despite the name, gistxlogPage is not part of any xlog record */ typedefstruct gistxlogPage
{
BlockNumber blkno; int num; /* number of index tuples following */
} gistxlogPage;
/* SplitPageLayout - gistSplit function result */ typedefstruct SplitPageLayout
{
gistxlogPage block;
IndexTupleData *list; int lenlist;
IndexTuple itup; /* union key for page */
Page page; /* to operate */
Buffer buffer; /* to write after all proceed */
/* offset of the downlink in the parent page, that points to this page */
OffsetNumber downlinkoffnum;
/* pointer to parent */ struct GISTInsertStack *parent;
} GISTInsertStack;
/* Working state and results for multi-column split logic in gistsplit.c */ typedefstruct GistSplitVector
{
GIST_SPLITVEC splitVector; /* passed to/from user PickSplit method */
Datum spl_lattr[INDEX_MAX_KEYS]; /* Union of subkeys in
* splitVector.spl_left */ bool spl_lisnull[INDEX_MAX_KEYS];
Datum spl_rattr[INDEX_MAX_KEYS]; /* Union of subkeys in
* splitVector.spl_right */ bool spl_risnull[INDEX_MAX_KEYS];
bool *spl_dontcare; /* flags tuples which could go to either side
* of the split for zero penalty */
} GistSplitVector;
typedefstruct
{
Relation r;
Relation heapRel;
Size freespace; /* free space to be left */ bool is_build;
GISTInsertStack *stack;
} GISTInsertState;
/* root page of a gist index */ #define GIST_ROOT_BLKNO 0
/* *Abufferattachedtoaninternalnode,usedwhenbuildinganindexin *bufferingmode.
*/ typedefstruct
{
BlockNumber nodeBlocknum; /* index block # this buffer is for */
int32 blocksCount; /* current # of blocks occupied by buffer */
/* Is specified buffer at least half-filled (should be queued for emptying)? */ #define BUFFER_HALF_FILLED(nodeBuffer, gfbb) \
((nodeBuffer)->blocksCount > (gfbb)->pagesPerBuffer / 2)
/* *Datastructurewithgeneralinformationaboutbuildbuffers.
*/ typedefstruct GISTBuildBuffers
{ /* Persistent memory context for the buffers and metadata. */
MemoryContext context;
BufFile *pfile; /* Temporary file to store buffers in */ long nFileBlocks; /* Current size of the temporary file */
/* *resizablearrayoffreeblocks.
*/ long *freeBlocks; int nFreeBlocks; /* # of currently free blocks in the array */ int freeBlocksLen; /* current allocated length of the array */
/* Hash for buffers by block number */
HTAB *nodeBuffersTab;
/* List of buffers scheduled for emptying */
List *bufferEmptyingQueue;
/* *Parameterstothebufferingbuildalgorithm.levelStepdetermineswhich *levelsinthetreehavebuffers,andpagesPerBufferdetermineshow *largeeachbufferis.
*/ int levelStep; int pagesPerBuffer;
/* Array of lists of buffers on each level, for final emptying */
List **buffersOnLevels; int buffersOnLevelsLen;
/* *Dynamically-sizedarrayofbuffersthatcurrentlyhavetheirlastpage *loadedinmainmemory.
*/
GISTNodeBuffer **loadedBuffers; int loadedBuffersCount; /* # of entries in loadedBuffers */ int loadedBuffersLen; /* allocated size of loadedBuffers */
/* Level of the current root node (= height of the index tree - 1) */ int rootlevel;
} GISTBuildBuffers;
/* A List of these is returned from gistplacetopage() in *splitinfo */ typedefstruct
{
Buffer buf; /* the split page "half" */
IndexTuple downlink; /* downlink for this half. */
} GISTPageSplitInfo;
/* gistvalidate.c */ externbool gistvalidate(Oid opclassoid); externvoid gistadjustmembers(Oid opfamilyoid,
Oid opclassoid,
List *operators,
List *functions);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.