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:740

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:740

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 1079 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().

1080 {
1081  Buffer metabuffer;
1082  Page metapage;
1083  BrinMetaPageData *metadata;
1084 
1085  metabuffer = ReadBuffer(index, BRIN_METAPAGE_BLKNO);
1086  LockBuffer(metabuffer, BUFFER_LOCK_SHARE);
1087  metapage = BufferGetPage(metabuffer);
1088  metadata = (BrinMetaPageData *) PageGetContents(metapage);
1089 
1090  stats->pagesPerRange = metadata->pagesPerRange;
1091  stats->revmapNumPages = metadata->lastRevmapPage - 1;
1092 
1093  UnlockReleaseBuffer(metabuffer);
1094 }
#define BRIN_METAPAGE_BLKNO
Definition: brin_page.h:75
void UnlockReleaseBuffer(Buffer buffer)
Definition: bufmgr.c:3388
#define BufferGetPage(buffer)
Definition: bufmgr.h:159
BlockNumber lastRevmapPage
Definition: brin_page.h:69
#define PageGetContents(page)
Definition: bufpage.h:246
void LockBuffer(Buffer buffer, int mode)
Definition: bufmgr.c:3602
BlockNumber pagesPerRange
Definition: brin.h:33
BlockNumber pagesPerRange
Definition: brin_page.h:68
Buffer ReadBuffer(Relation reln, BlockNumber blockNum)
Definition: bufmgr.c:596
#define BUFFER_LOCK_SHARE
Definition: bufmgr.h:87
int Buffer
Definition: buf.h:23
Pointer Page
Definition: bufpage.h:78
BlockNumber revmapNumPages
Definition: brin.h:34