PostgreSQL Source Code  git master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
brin.h File Reference
#include "fmgr.h"
#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

#define BRIN_DEFAULT_PAGES_PER_RANGE   128

Definition at line 39 of file brin.h.

#define BrinGetAutoSummarize (   relation)
Value:
((relation)->rd_options ? \
((BrinOptions *) (relation)->rd_options)->autosummarize : \
#define false
Definition: c.h:210

Definition at line 44 of file brin.h.

Referenced by brininsert().

#define BrinGetPagesPerRange (   relation)
Value:
((relation)->rd_options ? \
((BrinOptions *) (relation)->rd_options)->pagesPerRange : \
#define BRIN_DEFAULT_PAGES_PER_RANGE
Definition: brin.h:39

Definition at line 40 of file brin.h.

Referenced by brinbuild(), and brinbuildempty().

Typedef Documentation

Function Documentation

void brinGetStats ( Relation  index,
BrinStatsData stats 
)

Definition at line 1066 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().

1067 {
1068  Buffer metabuffer;
1069  Page metapage;
1070  BrinMetaPageData *metadata;
1071 
1072  metabuffer = ReadBuffer(index, BRIN_METAPAGE_BLKNO);
1073  LockBuffer(metabuffer, BUFFER_LOCK_SHARE);
1074  metapage = BufferGetPage(metabuffer);
1075  metadata = (BrinMetaPageData *) PageGetContents(metapage);
1076 
1077  stats->pagesPerRange = metadata->pagesPerRange;
1078  stats->revmapNumPages = metadata->lastRevmapPage - 1;
1079 
1080  UnlockReleaseBuffer(metabuffer);
1081 }
#define BRIN_METAPAGE_BLKNO
Definition: brin_page.h:75
void UnlockReleaseBuffer(Buffer buffer)
Definition: bufmgr.c:3332
#define BufferGetPage(buffer)
Definition: bufmgr.h:160
BlockNumber lastRevmapPage
Definition: brin_page.h:69
#define PageGetContents(page)
Definition: bufpage.h:242
void LockBuffer(Buffer buffer, int mode)
Definition: bufmgr.c:3546
BlockNumber pagesPerRange
Definition: brin.h:34
BlockNumber pagesPerRange
Definition: brin_page.h:68
Buffer ReadBuffer(Relation reln, BlockNumber blockNum)
Definition: bufmgr.c:594
#define BUFFER_LOCK_SHARE
Definition: bufmgr.h:88
int Buffer
Definition: buf.h:23
Pointer Page
Definition: bufpage.h:74
BlockNumber revmapNumPages
Definition: brin.h:35