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:
((relation)->rd_options ? \
((BrinOptions *) (relation)->rd_options)->autosummarize : \
false)

Definition at line 43 of file brin.h.

Referenced by brininsert().

◆ BrinGetPagesPerRange

#define BrinGetPagesPerRange (   relation)
Value:
((relation)->rd_options ? \
((BrinOptions *) (relation)->rd_options)->pagesPerRange : \
BRIN_DEFAULT_PAGES_PER_RANGE)

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

1094 {
1095  Buffer metabuffer;
1096  Page metapage;
1097  BrinMetaPageData *metadata;
1098 
1099  metabuffer = ReadBuffer(index, BRIN_METAPAGE_BLKNO);
1100  LockBuffer(metabuffer, BUFFER_LOCK_SHARE);
1101  metapage = BufferGetPage(metabuffer);
1102  metadata = (BrinMetaPageData *) PageGetContents(metapage);
1103 
1104  stats->pagesPerRange = metadata->pagesPerRange;
1105  stats->revmapNumPages = metadata->lastRevmapPage - 1;
1106 
1107  UnlockReleaseBuffer(metabuffer);
1108 }
#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