1
0
mirror of https://github.com/postgres/postgres.git synced 2025-10-24 01:29:19 +03:00

BRIN de-summarization

When the BRIN summary tuple for a page range becomes too "wide" for the
values actually stored in the table (because the tuples that were
present originally are no longer present due to updates or deletes), it
can be useful to remove the outdated summary tuple, so that a future
summarization can install a tighter summary.

This commit introduces a SQL-callable interface to do so.

Author: Álvaro Herrera
Reviewed-by: Eiji Seki
Discussion: https://postgr.es/m/20170228045643.n2ri74ara4fhhfxf@alvherre.pgsql
This commit is contained in:
Alvaro Herrera
2017-04-01 16:10:04 -03:00
parent 3a82129a40
commit c655899ba9
12 changed files with 340 additions and 5 deletions

View File

@@ -33,7 +33,7 @@
#define XLOG_BRIN_UPDATE 0x20
#define XLOG_BRIN_SAMEPAGE_UPDATE 0x30
#define XLOG_BRIN_REVMAP_EXTEND 0x40
#define XLOG_BRIN_REVMAP_VACUUM 0x50
#define XLOG_BRIN_DESUMMARIZE 0x50
#define XLOG_BRIN_OPMASK 0x70
/*
@@ -124,6 +124,24 @@ typedef struct xl_brin_revmap_extend
#define SizeOfBrinRevmapExtend (offsetof(xl_brin_revmap_extend, targetBlk) + \
sizeof(BlockNumber))
/*
* This is what we need to know about a range de-summarization
*
* Backup block 0: revmap page
* Backup block 1: regular page
*/
typedef struct xl_brin_desummarize
{
BlockNumber pagesPerRange;
/* page number location to set to invalid */
OffsetNumber heapBlk;
/* offset of item to delete in regular index page */
OffsetNumber regOffset;
} xl_brin_desummarize;
#define SizeOfBrinDesummarize (offsetof(xl_brin_desummarize, regOffset) + \
sizeof(OffsetNumber))
extern void brin_redo(XLogReaderState *record);
extern void brin_desc(StringInfo buf, XLogReaderState *record);