PostgreSQL Source Code  git master
gin_private.h
Go to the documentation of this file.
1 /*--------------------------------------------------------------------------
2  * gin_private.h
3  * header file for postgres inverted index access method implementation.
4  *
5  * Copyright (c) 2006-2020, PostgreSQL Global Development Group
6  *
7  * src/include/access/gin_private.h
8  *--------------------------------------------------------------------------
9  */
10 #ifndef GIN_PRIVATE_H
11 #define GIN_PRIVATE_H
12 
13 #include "access/amapi.h"
14 #include "access/gin.h"
15 #include "access/ginblock.h"
16 #include "access/itup.h"
17 #include "catalog/pg_am_d.h"
18 #include "fmgr.h"
19 #include "lib/rbtree.h"
20 #include "storage/bufmgr.h"
21 
22 /*
23  * Storage type for GIN's reloptions
24  */
25 typedef struct GinOptions
26 {
27  int32 vl_len_; /* varlena header (do not touch directly!) */
28  bool useFastUpdate; /* use fast updates? */
29  int pendingListCleanupSize; /* maximum size of pending list */
30 } GinOptions;
31 
32 #define GIN_DEFAULT_USE_FASTUPDATE true
33 #define GinGetUseFastUpdate(relation) \
34  (AssertMacro(relation->rd_rel->relkind == RELKIND_INDEX && \
35  relation->rd_rel->relam == GIN_AM_OID), \
36  (relation)->rd_options ? \
37  ((GinOptions *) (relation)->rd_options)->useFastUpdate : GIN_DEFAULT_USE_FASTUPDATE)
38 #define GinGetPendingListCleanupSize(relation) \
39  (AssertMacro(relation->rd_rel->relkind == RELKIND_INDEX && \
40  relation->rd_rel->relam == GIN_AM_OID), \
41  (relation)->rd_options && \
42  ((GinOptions *) (relation)->rd_options)->pendingListCleanupSize != -1 ? \
43  ((GinOptions *) (relation)->rd_options)->pendingListCleanupSize : \
44  gin_pending_list_limit)
45 
46 
47 /* Macros for buffer lock/unlock operations */
48 #define GIN_UNLOCK BUFFER_LOCK_UNLOCK
49 #define GIN_SHARE BUFFER_LOCK_SHARE
50 #define GIN_EXCLUSIVE BUFFER_LOCK_EXCLUSIVE
51 
52 
53 /*
54  * GinState: working data structure describing the index being worked on
55  */
56 typedef struct GinState
57 {
59  bool oneCol; /* true if single-column index */
60 
61  /*
62  * origTupdesc is the nominal tuple descriptor of the index, ie, the i'th
63  * attribute shows the key type (not the input data type!) of the i'th
64  * index column. In a single-column index this describes the actual leaf
65  * index tuples. In a multi-column index, the actual leaf tuples contain
66  * a smallint column number followed by a key datum of the appropriate
67  * type for that column. We set up tupdesc[i] to describe the actual
68  * rowtype of the index tuples for the i'th column, ie, (int2, keytype).
69  * Note that in any case, leaf tuples contain more data than is known to
70  * the TupleDesc; see access/gin/README for details.
71  */
74 
75  /*
76  * Per-index-column opclass support functions
77  */
79  FmgrInfo extractValueFn[INDEX_MAX_KEYS];
80  FmgrInfo extractQueryFn[INDEX_MAX_KEYS];
81  FmgrInfo consistentFn[INDEX_MAX_KEYS];
82  FmgrInfo triConsistentFn[INDEX_MAX_KEYS];
83  FmgrInfo comparePartialFn[INDEX_MAX_KEYS]; /* optional method */
84  /* canPartialMatch[i] is true if comparePartialFn[i] is valid */
85  bool canPartialMatch[INDEX_MAX_KEYS];
86  /* Collations to pass to the support functions */
87  Oid supportCollation[INDEX_MAX_KEYS];
88 } GinState;
89 
90 
91 /* ginutil.c */
92 extern bytea *ginoptions(Datum reloptions, bool validate);
95 extern void GinInitBuffer(Buffer b, uint32 f);
96 extern void GinInitPage(Page page, uint32 f, Size pageSize);
97 extern void GinInitMetabuffer(Buffer b);
98 extern int ginCompareEntries(GinState *ginstate, OffsetNumber attnum,
99  Datum a, GinNullCategory categorya,
100  Datum b, GinNullCategory categoryb);
101 extern int ginCompareAttEntries(GinState *ginstate,
102  OffsetNumber attnuma, Datum a, GinNullCategory categorya,
103  OffsetNumber attnumb, Datum b, GinNullCategory categoryb);
105  Datum value, bool isNull,
106  int32 *nentries, GinNullCategory **categories);
107 
108 extern OffsetNumber gintuple_get_attrnum(GinState *ginstate, IndexTuple tuple);
109 extern Datum gintuple_get_key(GinState *ginstate, IndexTuple tuple,
110  GinNullCategory *category);
111 
112 /* gininsert.c */
114  struct IndexInfo *indexInfo);
115 extern void ginbuildempty(Relation index);
116 extern bool gininsert(Relation index, Datum *values, bool *isnull,
117  ItemPointer ht_ctid, Relation heapRel,
118  IndexUniqueCheck checkUnique,
119  struct IndexInfo *indexInfo);
120 extern void ginEntryInsert(GinState *ginstate,
122  ItemPointerData *items, uint32 nitem,
123  GinStatsData *buildStats);
124 
125 /* ginbtree.c */
126 
127 typedef struct GinBtreeStack
128 {
133  /* predictNumber contains predicted number of pages on current level */
136 } GinBtreeStack;
137 
138 typedef struct GinBtreeData *GinBtree;
139 
140 /* Return codes for GinBtreeData.beginPlaceToPage method */
141 typedef enum
142 {
147 
148 typedef struct GinBtreeData
149 {
150  /* search methods */
151  BlockNumber (*findChildPage) (GinBtree, GinBtreeStack *);
152  BlockNumber (*getLeftMostChild) (GinBtree, Page);
153  bool (*isMoveRight) (GinBtree, Page);
154  bool (*findItem) (GinBtree, GinBtreeStack *);
155 
156  /* insert methods */
158  GinPlaceToPageRC (*beginPlaceToPage) (GinBtree, Buffer, GinBtreeStack *, void *, BlockNumber, void **, Page *, Page *);
159  void (*execPlaceToPage) (GinBtree, Buffer, GinBtreeStack *, void *, BlockNumber, void *);
160  void *(*prepareDownlink) (GinBtree, Buffer);
161  void (*fillRoot) (GinBtree, Page, BlockNumber, Page, BlockNumber, Page);
162 
163  bool isData;
164 
166  BlockNumber rootBlkno;
167  GinState *ginstate; /* not valid in a data scan */
168  bool fullScan;
169  bool isBuild;
170 
171  /* Search key for Entry tree */
175 
176  /* Search key for data tree (posting tree) */
178 } GinBtreeData;
179 
180 /* This represents a tuple to be inserted to entry tree. */
181 typedef struct
182 {
183  IndexTuple entry; /* tuple to insert */
184  bool isDelete; /* delete old tuple at same offset? */
186 
187 /*
188  * This represents an itempointer, or many itempointers, to be inserted to
189  * a data (posting tree) leaf page
190  */
191 typedef struct
192 {
197 
198 /*
199  * For internal data (posting tree) pages, the insertion payload is a
200  * PostingItem
201  */
202 
203 extern GinBtreeStack *ginFindLeafPage(GinBtree btree, bool searchMode,
204  bool rootConflictCheck, Snapshot snapshot);
205 extern Buffer ginStepRight(Buffer buffer, Relation index, int lockmode);
206 extern void freeGinBtreeStack(GinBtreeStack *stack);
207 extern void ginInsertValue(GinBtree btree, GinBtreeStack *stack,
208  void *insertdata, GinStatsData *buildStats);
209 
210 /* ginentrypage.c */
211 extern IndexTuple GinFormTuple(GinState *ginstate,
213  Pointer data, Size dataSize, int nipd, bool errorTooBig);
214 extern void ginPrepareEntryScan(GinBtree btree, OffsetNumber attnum,
215  Datum key, GinNullCategory category,
216  GinState *ginstate);
217 extern void ginEntryFillRoot(GinBtree btree, Page root, BlockNumber lblkno, Page lpage, BlockNumber rblkno, Page rpage);
219  IndexTuple itup, int *nitems);
220 
221 /* gindatapage.c */
222 extern ItemPointer GinDataLeafPageGetItems(Page page, int *nitems, ItemPointerData advancePast);
223 extern int GinDataLeafPageGetItemsToTbm(Page page, TIDBitmap *tbm);
225  ItemPointerData *items, uint32 nitems,
226  GinStatsData *buildStats, Buffer entrybuffer);
227 extern void GinDataPageAddPostingItem(Page page, PostingItem *data, OffsetNumber offset);
228 extern void GinPageDeletePostingItem(Page page, OffsetNumber offset);
229 extern void ginInsertItemPointers(Relation index, BlockNumber rootBlkno,
230  ItemPointerData *items, uint32 nitem,
231  GinStatsData *buildStats);
232 extern GinBtreeStack *ginScanBeginPostingTree(GinBtree btree, Relation index, BlockNumber rootBlkno, Snapshot snapshot);
233 extern void ginDataFillRoot(GinBtree btree, Page root, BlockNumber lblkno, Page lpage, BlockNumber rblkno, Page rpage);
234 
235 /*
236  * This is declared in ginvacuum.c, but is passed between ginVacuumItemPointers
237  * and ginVacuumPostingTreeLeaf and as an opaque struct, so we need a forward
238  * declaration for it.
239  */
241 
243 
244 /* ginscan.c */
245 
246 /*
247  * GinScanKeyData describes a single GIN index qualifier expression.
248  *
249  * From each qual expression, we extract one or more specific index search
250  * conditions, which are represented by GinScanEntryData. It's quite
251  * possible for identical search conditions to be requested by more than
252  * one qual expression, in which case we merge such conditions to have just
253  * one unique GinScanEntry --- this is particularly important for efficiency
254  * when dealing with full-index-scan entries. So there can be multiple
255  * GinScanKeyData.scanEntry pointers to the same GinScanEntryData.
256  *
257  * In each GinScanKeyData, nentries is the true number of entries, while
258  * nuserentries is the number that extractQueryFn returned (which is what
259  * we report to consistentFn). The "user" entries must come first.
260  */
261 typedef struct GinScanKeyData *GinScanKey;
262 
264 
265 typedef struct GinScanKeyData
266 {
267  /* Real number of entries in scanEntry[] (always > 0) */
269  /* Number of entries that extractQueryFn and consistentFn know about */
271 
272  /* array of GinScanEntry pointers, one per extracted search condition */
273  GinScanEntry *scanEntry;
274 
275  /*
276  * At least one of the entries in requiredEntries must be present for a
277  * tuple to match the overall qual.
278  *
279  * additionalEntries contains entries that are needed by the consistent
280  * function to decide if an item matches, but are not sufficient to
281  * satisfy the qual without entries from requiredEntries.
282  */
283  GinScanEntry *requiredEntries;
285  GinScanEntry *additionalEntries;
287 
288  /* array of check flags, reported to consistentFn */
290  bool (*boolConsistentFn) (GinScanKey key);
291  GinTernaryValue (*triConsistentFn) (GinScanKey key);
295 
296  /* other data needed for calling consistentFn */
298  /* NB: these three arrays have only nuserentries elements! */
305 
306  /*
307  * An excludeOnly scan key is not able to enumerate all matching tuples.
308  * That is, to be semantically correct on its own, it would need to have a
309  * GIN_CAT_EMPTY_QUERY scanEntry, but it doesn't. Such a key can still be
310  * used to filter tuples returned by other scan keys, so we will get the
311  * right answers as long as there's at least one non-excludeOnly scan key
312  * for each index attribute considered by the search. For efficiency
313  * reasons we don't want to have unnecessary GIN_CAT_EMPTY_QUERY entries,
314  * so we will convert an excludeOnly scan key to non-excludeOnly (by
315  * adding a GIN_CAT_EMPTY_QUERY scanEntry) only if there are no other
316  * non-excludeOnly scan keys.
317  */
319 
320  /*
321  * Match status data. curItem is the TID most recently tested (could be a
322  * lossy-page pointer). curItemMatches is true if it passes the
323  * consistentFn test; if so, recheckCurItem is the recheck flag.
324  * isFinished means that all the input entry streams are finished, so this
325  * key cannot succeed for any later TIDs.
326  */
332 
333 typedef struct GinScanEntryData
334 {
335  /* query key and other information from extractQueryFn */
343 
344  /* Current page in posting tree */
346 
347  /* current ItemPointer to heap */
349 
350  /* for a partial-match or full-scan query, we accumulate all TIDs here */
354 
355  /* used for Posting list and one page in Posting tree */
357  int nlist;
359 
365 
366 typedef struct GinScanOpaqueData
367 {
370 
371  GinScanKey keys; /* one per scan qualifier expr */
373 
374  GinScanEntry *entries; /* one per index search condition */
376  uint32 allocentries; /* allocated length of entries[] */
377 
378  MemoryContext keyCtx; /* used to hold key and entry data */
379 
380  bool isVoidRes; /* true if query is unsatisfiable */
382 
384 
385 extern IndexScanDesc ginbeginscan(Relation rel, int nkeys, int norderbys);
386 extern void ginendscan(IndexScanDesc scan);
387 extern void ginrescan(IndexScanDesc scan, ScanKey key, int nscankeys,
388  ScanKey orderbys, int norderbys);
389 extern void ginNewScanKey(IndexScanDesc scan);
390 extern void ginFreeScanKeys(GinScanOpaque so);
391 
392 /* ginget.c */
393 extern int64 gingetbitmap(IndexScanDesc scan, TIDBitmap *tbm);
394 
395 /* ginlogic.c */
396 extern void ginInitConsistentFunction(GinState *ginstate, GinScanKey key);
397 
398 /* ginvacuum.c */
400  IndexBulkDeleteResult *stats,
402  void *callback_state);
404  IndexBulkDeleteResult *stats);
406  ItemPointerData *items, int nitem, int *nremaining);
407 
408 /* ginvalidate.c */
409 extern bool ginvalidate(Oid opclassoid);
410 extern void ginadjustmembers(Oid opfamilyoid,
411  Oid opclassoid,
412  List *operators,
413  List *functions);
414 
415 /* ginbulk.c */
416 typedef struct GinEntryAccumulator
417 {
424  uint32 maxcount; /* allocated size of list[] */
425  uint32 count; /* current number of list[] entries */
427 
428 typedef struct
429 {
437 
438 extern void ginInitBA(BuildAccumulator *accum);
439 extern void ginInsertBAEntries(BuildAccumulator *accum,
441  Datum *entries, GinNullCategory *categories,
442  int32 nentries);
443 extern void ginBeginBAScan(BuildAccumulator *accum);
446  uint32 *n);
447 
448 /* ginfast.c */
449 
450 typedef struct GinTupleCollector
451 {
457 
458 extern void ginHeapTupleFastInsert(GinState *ginstate,
459  GinTupleCollector *collector);
460 extern void ginHeapTupleFastCollect(GinState *ginstate,
461  GinTupleCollector *collector,
462  OffsetNumber attnum, Datum value, bool isNull,
463  ItemPointer ht_ctid);
464 extern void ginInsertCleanup(GinState *ginstate, bool full_clean,
465  bool fill_fsm, bool forceCleanup, IndexBulkDeleteResult *stats);
466 
467 /* ginpostinglist.c */
468 
469 extern GinPostingList *ginCompressPostingList(const ItemPointer ipd, int nipd,
470  int maxsize, int *nwritten);
471 extern int ginPostingListDecodeAllSegmentsToTbm(GinPostingList *ptr, int totalsize, TIDBitmap *tbm);
472 
473 extern ItemPointer ginPostingListDecodeAllSegments(GinPostingList *ptr, int len, int *ndecoded);
474 extern ItemPointer ginPostingListDecode(GinPostingList *ptr, int *ndecoded);
476  ItemPointerData *b, uint32 nb,
477  int *nmerged);
478 
479 /*
480  * Merging the results of several gin scans compares item pointers a lot,
481  * so we want this to be inlined.
482  */
483 static inline int
485 {
486  uint64 ia = (uint64) GinItemPointerGetBlockNumber(a) << 32 | GinItemPointerGetOffsetNumber(a);
487  uint64 ib = (uint64) GinItemPointerGetBlockNumber(b) << 32 | GinItemPointerGetOffsetNumber(b);
488 
489  if (ia == ib)
490  return 0;
491  else if (ia > ib)
492  return 1;
493  else
494  return -1;
495 }
496 
497 extern int ginTraverseLock(Buffer buffer, bool searchMode);
498 
499 #endif /* GIN_PRIVATE_H */
void ginInsertValue(GinBtree btree, GinBtreeStack *stack, void *insertdata, GinStatsData *buildStats)
Definition: ginbtree.c:776
FmgrInfo * triConsistentFmgrInfo
Definition: gin_private.h:293
GinEntryAccumulator * entryallocator
Definition: gin_private.h:432
int ginPostingListDecodeAllSegmentsToTbm(GinPostingList *ptr, int totalsize, TIDBitmap *tbm)
OffsetNumber gintuple_get_attrnum(GinState *ginstate, IndexTuple tuple)
Definition: ginutil.c:224
Datum * queryValues
Definition: gin_private.h:299
void ginInsertCleanup(GinState *ginstate, bool full_clean, bool fill_fsm, bool forceCleanup, IndexBulkDeleteResult *stats)
Definition: ginfast.c:774
GinBtreeData btree
Definition: gin_private.h:363
Definition: fmgr.h:56
ItemPointerData curItem
Definition: gin_private.h:348
void freeGinBtreeStack(GinBtreeStack *stack)
Definition: ginbtree.c:194
OffsetNumber offset
Definition: gin_private.h:358
GinState * ginstate
Definition: gin_private.h:167
int ginCompareAttEntries(GinState *ginstate, OffsetNumber attnuma, Datum a, GinNullCategory categorya, OffsetNumber attnumb, Datum b, GinNullCategory categoryb)
Definition: ginutil.c:417
Pointer * extra_data
Definition: gin_private.h:301
uint32 predictNumberResult
Definition: gin_private.h:362
Relation index
Definition: gin_private.h:58
#define GinItemPointerGetOffsetNumber(pointer)
Definition: ginblock.h:147
struct GinBtreeData GinBtreeData
OffsetNumber off
Definition: gin_private.h:131
struct GinScanEntryData GinScanEntryData
void GinInitPage(Page page, uint32 f, Size pageSize)
Definition: ginutil.c:344
int ginTraverseLock(Buffer buffer, bool searchMode)
Definition: ginbtree.c:36
TBMIterator * matchIterator
Definition: gin_private.h:352
void ginPrepareEntryScan(GinBtree btree, OffsetNumber attnum, Datum key, GinNullCategory category, GinState *ginstate)
Definition: ginentrypage.c:745
struct GinScanOpaqueData GinScanOpaqueData
OffsetNumber attnum
Definition: gin_private.h:421
void GinDataPageAddPostingItem(Page page, PostingItem *data, OffsetNumber offset)
Definition: gindatapage.c:380
void ginInsertItemPointers(Relation index, BlockNumber rootBlkno, ItemPointerData *items, uint32 nitem, GinStatsData *buildStats)
Definition: gindatapage.c:1902
uint16 StrategyNumber
Definition: stratnum.h:22
Pointer extra_data
Definition: gin_private.h:339
bool useFastUpdate
Definition: gin_private.h:28
void ginrescan(IndexScanDesc scan, ScanKey key, int nscankeys, ScanKey orderbys, int norderbys)
Definition: ginscan.c:442
Buffer GinNewBuffer(Relation index)
Definition: ginutil.c:298
BlockNumber rootBlkno
Definition: gin_private.h:166
uint32 BlockNumber
Definition: block.h:31
void ginHeapTupleFastInsert(GinState *ginstate, GinTupleCollector *collector)
Definition: ginfast.c:219
FmgrInfo * consistentFmgrInfo
Definition: gin_private.h:292
GinNullCategory category
Definition: gin_private.h:420
void ginEntryInsert(GinState *ginstate, OffsetNumber attnum, Datum key, GinNullCategory category, ItemPointerData *items, uint32 nitem, GinStatsData *buildStats)
Definition: gininsert.c:179
unsigned int Oid
Definition: postgres_ext.h:31
ItemPointerData * list
Definition: gin_private.h:356
signed int int32
Definition: c.h:362
uint16 OffsetNumber
Definition: off.h:24
Definition: type.h:89
IndexUniqueCheck
Definition: genam.h:112
void ginbuildempty(Relation index)
Definition: gininsert.c:437
GinScanEntry * scanEntry
Definition: gin_private.h:273
OffsetNumber entryAttnum
Definition: gin_private.h:172
void ginInitConsistentFunction(GinState *ginstate, GinScanKey key)
Definition: ginlogic.c:223
char * Pointer
Definition: c.h:351
GinPlaceToPageRC
Definition: gin_private.h:141
signed char GinNullCategory
Definition: ginblock.h:207
GinBtreeStack * ginScanBeginPostingTree(GinBtree btree, Relation index, BlockNumber rootBlkno, Snapshot snapshot)
Definition: gindatapage.c:1930
struct GinScanKeyData * GinScanKey
Definition: gin_private.h:261
Datum entryKey
Definition: gin_private.h:173
char GinTernaryValue
Definition: gin.h:58
static void callback(struct sockaddr *addr, struct sockaddr *mask, void *unused)
Definition: test_ifaddrs.c:48
GinNullCategory entryCategory
Definition: gin_private.h:174
OffsetNumber attnum
Definition: gin_private.h:342
IndexBuildResult * ginbuild(Relation heap, Relation index, struct IndexInfo *indexInfo)
Definition: gininsert.c:320
struct GinBtreeStack GinBtreeStack
StrategyNumber strategy
Definition: gin_private.h:302
void ginEntryFillRoot(GinBtree btree, Page root, BlockNumber lblkno, Page lpage, BlockNumber rblkno, Page rpage)
Definition: ginentrypage.c:721
GinScanOpaqueData * GinScanOpaque
Definition: gin_private.h:383
bytea * ginoptions(Datum reloptions, bool validate)
Definition: ginutil.c:609
static char * buf
Definition: pg_test_fsync.c:67
void initGinState(GinState *state, Relation index)
Definition: ginutil.c:95
void ginInsertBAEntries(BuildAccumulator *accum, ItemPointer heapptr, OffsetNumber attnum, Datum *entries, GinNullCategory *categories, int32 nentries)
Definition: ginbulk.c:210
MemoryContext keyCtx
Definition: gin_private.h:378
GinTernaryValue * entryRes
Definition: gin_private.h:289
void ginHeapTupleFastCollect(GinState *ginstate, GinTupleCollector *collector, OffsetNumber attnum, Datum value, bool isNull, ItemPointer ht_ctid)
Definition: ginfast.c:474
struct GinBtreeData * GinBtree
Definition: gin_private.h:138
unsigned int uint32
Definition: c.h:374
GinState * ginstate
Definition: gin_private.h:430
OffsetNumber attnum
Definition: gin_private.h:304
Buffer ginStepRight(Buffer buffer, Relation index, int lockmode)
Definition: ginbtree.c:173
struct GinEntryAccumulator GinEntryAccumulator
void ginendscan(IndexScanDesc scan)
Definition: ginscan.c:458
ItemPointer GinDataLeafPageGetItems(Page page, int *nitems, ItemPointerData advancePast)
Definition: gindatapage.c:135
bool gininsert(Relation index, Datum *values, bool *isnull, ItemPointer ht_ctid, Relation heapRel, IndexUniqueCheck checkUnique, struct IndexInfo *indexInfo)
Definition: gininsert.c:488
struct GinScanEntryData * GinScanEntry
Definition: gin_private.h:263
uint32 nuserentries
Definition: gin_private.h:270
ItemPointer ginVacuumItemPointers(GinVacuumState *gvs, ItemPointerData *items, int nitem, int *nremaining)
Definition: ginvacuum.c:48
void GinPageDeletePostingItem(Page page, OffsetNumber offset)
Definition: gindatapage.c:417
TIDBitmap * matchBitmap
Definition: gin_private.h:351
void ginFreeScanKeys(GinScanOpaque so)
Definition: ginscan.c:233
GinScanKey keys
Definition: gin_private.h:371
IndexTuple * tuples
Definition: gin_private.h:452
MemoryContext tempCtx
Definition: gin_private.h:368
GinBtreeStack * ginFindLeafPage(GinBtree btree, bool searchMode, bool rootConflictCheck, Snapshot snapshot)
Definition: ginbtree.c:80
GinScanEntry * requiredEntries
Definition: gin_private.h:283
struct GinScanKeyData GinScanKeyData
ItemPointerData * items
Definition: gin_private.h:193
uintptr_t Datum
Definition: postgres.h:367
struct GinBtreeStack * parent
Definition: gin_private.h:135
StrategyNumber strategy
Definition: gin_private.h:340
int32 vl_len_
Definition: gin_private.h:27
Relation index
Definition: gin_private.h:165
GinNullCategory * queryCategories
Definition: gin_private.h:300
TBMIterateResult * matchResult
Definition: gin_private.h:353
int16 attnum
Definition: pg_attribute.h:79
static struct @143 value
void ginVacuumPostingTreeLeaf(Relation rel, Buffer buf, GinVacuumState *gvs)
Definition: gindatapage.c:735
Datum gintuple_get_key(GinState *ginstate, IndexTuple tuple, GinNullCategory *category)
Definition: ginutil.c:257
IndexScanDesc ginbeginscan(Relation rel, int nkeys, int norderbys)
Definition: ginscan.c:25
void ginDataFillRoot(GinBtree btree, Page root, BlockNumber lblkno, Page lpage, BlockNumber rblkno, Page rpage)
Definition: gindatapage.c:1343
Definition: regguts.h:298
bool ginvalidate(Oid opclassoid)
Definition: ginvalidate.c:33
ItemPointer ginPostingListDecode(GinPostingList *ptr, int *ndecoded)
GinNullCategory queryCategory
Definition: gin_private.h:337
void GinInitBuffer(Buffer b, uint32 f)
Definition: ginutil.c:357
IndexTuple GinFormTuple(GinState *ginstate, OffsetNumber attnum, Datum key, GinNullCategory category, Pointer data, Size dataSize, int nipd, bool errorTooBig)
Definition: ginentrypage.c:45
IndexBulkDeleteResult * ginvacuumcleanup(IndexVacuumInfo *info, IndexBulkDeleteResult *stats)
Definition: ginvacuum.c:687
#define INDEX_MAX_KEYS
int ginCompareEntries(GinState *ginstate, OffsetNumber attnum, Datum a, GinNullCategory categorya, Datum b, GinNullCategory categoryb)
Definition: ginutil.c:395
size_t Size
Definition: c.h:473
int64 gingetbitmap(IndexScanDesc scan, TIDBitmap *tbm)
Definition: ginget.c:1917
GinPostingList * ginCompressPostingList(const ItemPointer ipd, int nipd, int maxsize, int *nwritten)
static const struct fns functions
Definition: regcomp.c:298
Datum * ginExtractEntries(GinState *ginstate, OffsetNumber attnum, Datum value, bool isNull, int32 *nentries, GinNullCategory **categories)
Definition: ginutil.c:490
void ginadjustmembers(Oid opfamilyoid, Oid opclassoid, List *operators, List *functions)
Definition: ginvalidate.c:279
BlockNumber blkno
Definition: gin_private.h:129
ItemPointerData curItem
Definition: gin_private.h:327
ItemPointerData iptr
Definition: gin_private.h:132
static int ginCompareItemPointers(ItemPointer a, ItemPointer b)
Definition: gin_private.h:484
uint32 predictNumber
Definition: gin_private.h:134
static Datum values[MAXATTR]
Definition: bootstrap.c:165
ItemPointer ginReadTuple(GinState *ginstate, OffsetNumber attnum, IndexTuple itup, int *nitems)
Definition: ginentrypage.c:163
void GinInitMetabuffer(Buffer b)
Definition: ginutil.c:363
struct GinTupleCollector GinTupleCollector
Definition: rbtree.h:23
GinScanEntry * entries
Definition: gin_private.h:374
void ginBeginBAScan(BuildAccumulator *accum)
Definition: ginbulk.c:257
struct GinState GinState
ItemPointerData itemptr
Definition: gin_private.h:177
int GinDataLeafPageGetItemsToTbm(Page page, TIDBitmap *tbm)
Definition: gindatapage.c:182
GinScanEntry * additionalEntries
Definition: gin_private.h:285
Definition: rbtree.c:41
ItemPointer ginMergeItemPointers(ItemPointerData *a, uint32 na, ItemPointerData *b, uint32 nb, int *nmerged)
ItemPointerData * ginGetBAEntry(BuildAccumulator *accum, OffsetNumber *attnum, Datum *key, GinNullCategory *category, uint32 *n)
Definition: ginbulk.c:268
Definition: c.h:562
TupleDesc origTupdesc
Definition: gin_private.h:72
IndexBulkDeleteResult * ginbulkdelete(IndexVacuumInfo *info, IndexBulkDeleteResult *stats, IndexBulkDeleteCallback callback, void *callback_state)
Definition: ginvacuum.c:564
RBTreeIterator tree_walk
Definition: gin_private.h:435
BlockNumber createPostingTree(Relation index, ItemPointerData *items, uint32 nitems, GinStatsData *buildStats, Buffer entrybuffer)
Definition: gindatapage.c:1769
ItemPointer ginPostingListDecodeAllSegments(GinPostingList *ptr, int len, int *ndecoded)
void ginInitBA(BuildAccumulator *accum)
Definition: ginbulk.c:109
bool oneCol
Definition: gin_private.h:59
#define GinItemPointerGetBlockNumber(pointer)
Definition: ginblock.h:144
Definition: pg_list.h:50
int Buffer
Definition: buf.h:23
int pendingListCleanupSize
Definition: gin_private.h:29
Pointer Page
Definition: bufpage.h:78
ItemPointerData * list
Definition: gin_private.h:423
bool(* IndexBulkDeleteCallback)(ItemPointer itemptr, void *state)
Definition: genam.h:84
unsigned char bool
Definition: c.h:324
void ginNewScanKey(IndexScanDesc scan)
Definition: ginscan.c:263
struct GinOptions GinOptions