PostgreSQL Source Code  git master
brin.h File Reference
#include "nodes/execnodes.h"
#include "utils/relcache.h"
Include dependency graph for brin.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  BrinOptions
 
struct  BrinStatsData
 

Macros

#define BRIN_DEFAULT_PAGES_PER_RANGE   128
 
#define BrinGetPagesPerRange(relation)
 
#define BrinGetAutoSummarize(relation)
 

Typedefs

typedef struct BrinOptions BrinOptions
 
typedef struct BrinStatsData BrinStatsData
 

Functions

void brinGetStats (Relation index, BrinStatsData *stats)
 

Macro Definition Documentation

◆ BRIN_DEFAULT_PAGES_PER_RANGE

#define BRIN_DEFAULT_PAGES_PER_RANGE   128

Definition at line 38 of file brin.h.

◆ BrinGetAutoSummarize

#define BrinGetAutoSummarize (   relation)
Value:
(AssertMacro(relation->rd_rel->relkind == RELKIND_INDEX && \
relation->rd_rel->relam == BRIN_AM_OID), \
(relation)->rd_options ? \
((BrinOptions *) (relation)->rd_options)->autosummarize : \
false)
#define AssertMacro(condition)
Definition: c.h:795

Definition at line 45 of file brin.h.

◆ BrinGetPagesPerRange

#define BrinGetPagesPerRange (   relation)
Value:
(AssertMacro(relation->rd_rel->relkind == RELKIND_INDEX && \
relation->rd_rel->relam == BRIN_AM_OID), \
(relation)->rd_options ? \
((BrinOptions *) (relation)->rd_options)->pagesPerRange : \
BRIN_DEFAULT_PAGES_PER_RANGE)

Definition at line 39 of file brin.h.

Typedef Documentation

◆ BrinOptions

typedef struct BrinOptions BrinOptions

◆ BrinStatsData

typedef struct BrinStatsData BrinStatsData

Function Documentation

◆ brinGetStats()

void brinGetStats ( Relation  index,
BrinStatsData stats 
)

Definition at line 1254 of file brin.c.

1255 {
1256  Buffer metabuffer;
1257  Page metapage;
1258  BrinMetaPageData *metadata;
1259 
1260  metabuffer = ReadBuffer(index, BRIN_METAPAGE_BLKNO);
1261  LockBuffer(metabuffer, BUFFER_LOCK_SHARE);
1262  metapage = BufferGetPage(metabuffer);
1263  metadata = (BrinMetaPageData *) PageGetContents(metapage);
1264 
1265  stats->pagesPerRange = metadata->pagesPerRange;
1266  stats->revmapNumPages = metadata->lastRevmapPage - 1;
1267 
1268  UnlockReleaseBuffer(metabuffer);
1269 }
#define BRIN_METAPAGE_BLKNO
Definition: brin_page.h:75
int Buffer
Definition: buf.h:23
void UnlockReleaseBuffer(Buffer buffer)
Definition: bufmgr.c:3954
void LockBuffer(Buffer buffer, int mode)
Definition: bufmgr.c:4172
Buffer ReadBuffer(Relation reln, BlockNumber blockNum)
Definition: bufmgr.c:712
#define BUFFER_LOCK_SHARE
Definition: bufmgr.h:106
static Page BufferGetPage(Buffer buffer)
Definition: bufmgr.h:280
static char * PageGetContents(Page page)
Definition: bufpage.h:254
Pointer Page
Definition: bufpage.h:78
BlockNumber lastRevmapPage
Definition: brin_page.h:69
BlockNumber pagesPerRange
Definition: brin_page.h:68
BlockNumber revmapNumPages
Definition: brin.h:34
BlockNumber pagesPerRange
Definition: brin.h:33
Definition: type.h:95

References BRIN_METAPAGE_BLKNO, BUFFER_LOCK_SHARE, BufferGetPage(), BrinMetaPageData::lastRevmapPage, LockBuffer(), PageGetContents(), BrinStatsData::pagesPerRange, BrinMetaPageData::pagesPerRange, ReadBuffer(), BrinStatsData::revmapNumPages, and UnlockReleaseBuffer().

Referenced by brincostestimate().