diff options
author | Tomas Vondra | 2021-03-26 12:54:29 +0000 |
---|---|---|
committer | Tomas Vondra | 2021-03-26 12:54:30 +0000 |
commit | ab596105b55f1d7fbd5a66b66f65227d210b047d (patch) | |
tree | ba03f65e68913c0a684e9483a0c43e0df0229ee3 /src/include/access/brin_tuple.h | |
parent | 77b88cd1bb9041a735f24072150cacfa06c699a3 (diff) |
BRIN minmax-multi indexes
Adds BRIN opclasses similar to the existing minmax, except that instead
of summarizing the page range into a single [min,max] range, the summary
consists of multiple ranges and/or points, allowing gaps. This allows
more efficient handling of data with poor correlation to physical
location within the table and/or outlier values, for which the regular
minmax opclassed tend to work poorly.
It's possible to specify the number of values kept for each page range,
either as a single point or an interval boundary.
CREATE TABLE t (a int);
CREATE INDEX ON t
USING brin (a int4_minmax_multi_ops(values_per_range=16));
When building the summary, the values are combined into intervals with
the goal to minimize the "covering" (sum of interval lengths), using a
support procedure computing distance between two values.
Bump catversion, due to various catalog changes.
Author: Tomas Vondra <[email protected]>
Reviewed-by: Alvaro Herrera <[email protected]>
Reviewed-by: Alexander Korotkov <[email protected]>
Reviewed-by: Sokolov Yura <[email protected]>
Reviewed-by: John Naylor <[email protected]>
Discussion: https://postgr.es/m/[email protected]
Discussion: https://postgr.es/m/5d78b774-7e9c-c94e-12cf-fef51cc89b1a%402ndquadrant.com
Diffstat (limited to 'src/include/access/brin_tuple.h')
-rw-r--r-- | src/include/access/brin_tuple.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/include/access/brin_tuple.h b/src/include/access/brin_tuple.h index 5715bd58df7..87de94f3970 100644 --- a/src/include/access/brin_tuple.h +++ b/src/include/access/brin_tuple.h @@ -14,6 +14,11 @@ #include "access/brin_internal.h" #include "access/tupdesc.h" +/* + * The BRIN opclasses may register serialization callback, in case the on-disk + * and in-memory representations differ (e.g. for performance reasons). + */ +typedef void (*brin_serialize_callback_type) (BrinDesc *bdesc, Datum src, Datum *dst); /* * A BRIN index stores one index tuple per page range. Each index tuple @@ -27,6 +32,9 @@ typedef struct BrinValues bool bv_hasnulls; /* are there any nulls in the page range? */ bool bv_allnulls; /* are all values nulls in the page range? */ Datum *bv_values; /* current accumulated values */ + Datum bv_mem_value; /* expanded accumulated values */ + MemoryContext bv_context; + brin_serialize_callback_type bv_serialize; } BrinValues; /* |