codekingpro/portable-devtools
114k
1/*2 * AM-callable functions for BRIN indexes3 *4 * Portions Copyright (c) 1996-2023, PostgreSQL Global Development Group5 * Portions Copyright (c) 1994, Regents of the University of California6 *7 * IDENTIFICATION8 * src/include/access/brin.h9 */10#ifndef BRIN_H11#define BRIN_H12 13#include "nodes/execnodes.h"14#include "utils/relcache.h"15 16 17/*18 * Storage type for BRIN's reloptions19 */20typedef struct BrinOptions21{22 int32 vl_len_; /* varlena header (do not touch directly!) */23 BlockNumber pagesPerRange;24 bool autosummarize;25} BrinOptions;26 27 28/*29 * BrinStatsData represents stats data for planner use30 */31typedef struct BrinStatsData32{33 BlockNumber pagesPerRange;34 BlockNumber revmapNumPages;35} BrinStatsData;36 37 38#define BRIN_DEFAULT_PAGES_PER_RANGE 12839#define BrinGetPagesPerRange(relation) \40 (AssertMacro(relation->rd_rel->relkind == RELKIND_INDEX && \41 relation->rd_rel->relam == BRIN_AM_OID), \42 (relation)->rd_options ? \43 ((BrinOptions *) (relation)->rd_options)->pagesPerRange : \44 BRIN_DEFAULT_PAGES_PER_RANGE)45#define BrinGetAutoSummarize(relation) \46 (AssertMacro(relation->rd_rel->relkind == RELKIND_INDEX && \47 relation->rd_rel->relam == BRIN_AM_OID), \48 (relation)->rd_options ? \49 ((BrinOptions *) (relation)->rd_options)->autosummarize : \50 false)51 52 53extern void brinGetStats(Relation index, BrinStatsData *stats);54 55#endif /* BRIN_H */56 