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.

Referenced by brincostestimate().

◆ 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:739

Definition at line 45 of file brin.h.

Referenced by brininsert().

◆ 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)
#define AssertMacro(condition)
Definition: c.h:739

Definition at line 39 of file brin.h.

Referenced by brinbuild(), and brinbuildempty().

Typedef Documentation

◆ BrinOptions

typedef struct BrinOptions BrinOptions

◆ BrinStatsData

typedef struct BrinStatsData BrinStatsData

Function Documentation

◆ brinGetStats()

void brinGetStats ( Relation  index,
BrinStatsData stats 
)

Definition at line 1085 of file brin.c.

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

Referenced by brincostestimate().

1086 {
1087  Buffer metabuffer;
1088  Page metapage;
1089  BrinMetaPageData *metadata;
1090 
1091  metabuffer = ReadBuffer(index, BRIN_METAPAGE_BLKNO);
1092  LockBuffer(metabuffer, BUFFER_LOCK_SHARE);
1093  metapage = BufferGetPage(metabuffer);
1094  metadata = (BrinMetaPageData *) PageGetContents(metapage);
1095 
1096  stats->pagesPerRange = metadata->pagesPerRange;
1097  stats->revmapNumPages = metadata->lastRevmapPage - 1;
1098 
1099  UnlockReleaseBuffer(metabuffer);
1100 }
#define BRIN_METAPAGE_BLKNO
Definition: brin_page.h:75
void UnlockReleaseBuffer(Buffer buffer)
Definition: bufmgr.c:3506
#define BufferGetPage(buffer)
Definition: bufmgr.h:169
BlockNumber lastRevmapPage
Definition: brin_page.h:69
#define PageGetContents(page)
Definition: bufpage.h:246
void LockBuffer(Buffer buffer, int mode)
Definition: bufmgr.c:3722
BlockNumber pagesPerRange
Definition: brin.h:33
BlockNumber pagesPerRange
Definition: brin_page.h:68
Buffer ReadBuffer(Relation reln, BlockNumber blockNum)
Definition: bufmgr.c:606
#define BUFFER_LOCK_SHARE
Definition: bufmgr.h:97
int Buffer
Definition: buf.h:23
Pointer Page
Definition: bufpage.h:78
BlockNumber revmapNumPages
Definition: brin.h:34