2 * AM-callable functions for BRIN indexes
4 * Portions Copyright (c) 1996-2021, PostgreSQL Global Development Group
5 * Portions Copyright (c) 1994, Regents of the University of California
8 * src/include/access/brin.h
13 #include "nodes/execnodes.h"
14 #include "utils/relcache.h"
18 * Storage type for BRIN's reloptions
20 typedef struct BrinOptions
22 int32 vl_len_
; /* varlena header (do not touch directly!) */
23 BlockNumber pagesPerRange
;
29 * BrinStatsData represents stats data for planner use
31 typedef struct BrinStatsData
33 BlockNumber pagesPerRange
;
34 BlockNumber revmapNumPages
;
38 #define BRIN_DEFAULT_PAGES_PER_RANGE 128
39 #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 : \
53 extern void brinGetStats(Relation index
, BrinStatsData
*stats
);