核心 PostgreSQL 发行版包括 表 71.1 中所示的 BRIN 运算符类。
minmax 运算符类存储范围内索引列中出现的最小值和最大值。inclusion 运算符类存储一个值,该值包含范围内索引列中的值。bloom 运算符类为范围内的所有值构建布隆过滤器。minmax-multi 运算符类存储多个最小值和最大值,表示范围内索引列中出现的多个值。
表 71.1. 内置 BRIN 运算符类
名称 | 可索引运算符 |
---|---|
bit_minmax_ops |
= (bit,bit) |
< (bit,bit) |
|
> (bit,bit) |
|
<= (bit,bit) |
|
>= (bit,bit) |
|
box_inclusion_ops |
@> (box,point) |
<< (box,box) |
|
&< (box,box) |
|
&> (box,box) |
|
>> (box,box) |
|
<@ (box,box) |
|
@> (box,box) |
|
~= (box,box) |
|
&& (box,box) |
|
<<| (box,box) |
|
&<| (box,box) |
|
|&> (box,box) |
|
|>> (box,box) |
|
bpchar_bloom_ops |
= (character,character) |
bpchar_minmax_ops |
= (character,character) |
< (character,character) |
|
<= (character,character) |
|
> (character,character) |
|
>= (character,character) |
|
bytea_bloom_ops |
= (bytea,bytea) |
bytea_minmax_ops |
= (bytea,bytea) |
< (bytea,bytea) |
|
<= (bytea,bytea) |
|
> (bytea,bytea) |
|
>= (bytea,bytea) |
|
char_bloom_ops |
= ("char","char") |
char_minmax_ops |
= ("char","char") |
< ("char","char") |
|
<= ("char","char") |
|
> ("char","char") |
|
>= ("char","char") |
|
date_bloom_ops |
= (date,date) |
date_minmax_ops |
= (date,date) |
< (date,date) |
|
<= (date,date) |
|
> (date,date) |
|
>= (date,date) |
|
date_minmax_multi_ops |
= (date,date) |
< (date,date) |
|
<= (date,date) |
|
> (date,date) |
|
>= (date,date) |
|
float4_bloom_ops |
= (float4,float4) |
float4_minmax_ops |
= (float4,float4) |
< (float4,float4) |
|
> (float4,float4) |
|
<= (float4,float4) |
|
>= (float4,float4) |
|
float4_minmax_multi_ops |
= (float4,float4) |
< (float4,float4) |
|
> (float4,float4) |
|
<= (float4,float4) |
|
>= (float4,float4) |
|
float8_bloom_ops |
= (float8,float8) |
float8_minmax_ops |
= (float8,float8) |
< (float8,float8) |
|
<= (float8,float8) |
|
> (float8,float8) |
|
>= (float8,float8) |
|
float8_minmax_multi_ops |
= (float8,float8) |
< (float8,float8) |
|
<= (float8,float8) |
|
> (float8,float8) |
|
>= (float8,float8) |
|
inet_inclusion_ops |
<< (inet,inet) |
<<= (inet,inet) |
|
>> (inet,inet) |
|
>>= (inet,inet) |
|
= (inet,inet) |
|
&& (inet,inet) |
|
inet_bloom_ops |
= (inet,inet) |
inet_minmax_ops |
= (inet,inet) |
< (inet,inet) |
|
<= (inet,inet) |
|
> (inet,inet) |
|
>= (inet,inet) |
|
inet_minmax_multi_ops |
= (inet,inet) |
< (inet,inet) |
|
<= (inet,inet) |
|
> (inet,inet) |
|
>= (inet,inet) |
|
int2_bloom_ops |
= (int2,int2) |
int2_minmax_ops |
= (int2,int2) |
< (int2,int2) |
|
> (int2,int2) |
|
<= (int2,int2) |
|
>= (int2,int2) |
|
int2_minmax_multi_ops |
= (int2,int2) |
< (int2,int2) |
|
> (int2,int2) |
|
<= (int2,int2) |
|
>= (int2,int2) |
|
int4_bloom_ops |
= (int4,int4) |
int4_minmax_ops |
= (int4,int4) |
< (int4,int4) |
|
> (int4,int4) |
|
<= (int4,int4) |
|
>= (int4,int4) |
|
int4_minmax_multi_ops |
= (int4,int4) |
< (int4,int4) |
|
> (int4,int4) |
|
<= (int4,int4) |
|
>= (int4,int4) |
|
int8_bloom_ops |
= (bigint,bigint) |
int8_minmax_ops |
= (bigint,bigint) |
< (bigint,bigint) |
|
> (bigint,bigint) |
|
<= (bigint,bigint) |
|
>= (bigint,bigint) |
|
int8_minmax_multi_ops |
= (bigint,bigint) |
< (bigint,bigint) |
|
> (bigint,bigint) |
|
<= (bigint,bigint) |
|
>= (bigint,bigint) |
|
interval_bloom_ops |
= (interval,interval) |
interval_minmax_ops |
= (interval,interval) |
< (interval,interval) |
|
<= (interval,interval) |
|
> (interval,interval) |
|
>= (interval,interval) |
|
interval_minmax_multi_ops |
= (interval,interval) |
< (interval,interval) |
|
<= (interval,interval) |
|
> (interval,interval) |
|
>= (interval,interval) |
|
macaddr_bloom_ops |
= (macaddr,macaddr) |
macaddr_minmax_ops |
= (macaddr,macaddr) |
< (macaddr,macaddr) |
|
<= (macaddr,macaddr) |
|
> (macaddr,macaddr) |
|
>= (macaddr,macaddr) |
|
macaddr_minmax_multi_ops |
= (macaddr,macaddr) |
< (macaddr,macaddr) |
|
<= (macaddr,macaddr) |
|
> (macaddr,macaddr) |
|
>= (macaddr,macaddr) |
|
macaddr8_bloom_ops |
= (macaddr8,macaddr8) |
macaddr8_minmax_ops |
= (macaddr8,macaddr8) |
< (macaddr8,macaddr8) |
|
<= (macaddr8,macaddr8) |
|
> (macaddr8,macaddr8) |
|
>= (macaddr8,macaddr8) |
|
macaddr8_minmax_multi_ops |
= (macaddr8,macaddr8) |
< (macaddr8,macaddr8) |
|
<= (macaddr8,macaddr8) |
|
> (macaddr8,macaddr8) |
|
>= (macaddr8,macaddr8) |
|
name_bloom_ops |
= (name,name) |
name_minmax_ops |
= (name,name) |
< (name,name) |
|
<= (name,name) |
|
> (name,name) |
|
>= (name,name) |
|
numeric_bloom_ops |
= (numeric,numeric) |
numeric_minmax_ops |
= (numeric,numeric) |
< (numeric,numeric) |
|
<= (numeric,numeric) |
|
> (numeric,numeric) |
|
>= (numeric,numeric) |
|
numeric_minmax_multi_ops |
= (numeric,numeric) |
< (numeric,numeric) |
|
<= (numeric,numeric) |
|
> (numeric,numeric) |
|
>= (numeric,numeric) |
|
oid_bloom_ops |
= (oid,oid) |
oid_minmax_ops |
= (oid,oid) |
< (oid,oid) |
|
> (oid,oid) |
|
<= (oid,oid) |
|
>= (oid,oid) |
|
oid_minmax_multi_ops |
= (oid,oid) |
< (oid,oid) |
|
> (oid,oid) |
|
<= (oid,oid) |
|
>= (oid,oid) |
|
pg_lsn_bloom_ops |
= (pg_lsn,pg_lsn) |
pg_lsn_minmax_ops |
= (pg_lsn,pg_lsn) |
< (pg_lsn,pg_lsn) |
|
> (pg_lsn,pg_lsn) |
|
<= (pg_lsn,pg_lsn) |
|
>= (pg_lsn,pg_lsn) |
|
pg_lsn_minmax_multi_ops |
= (pg_lsn,pg_lsn) |
< (pg_lsn,pg_lsn) |
|
> (pg_lsn,pg_lsn) |
|
<= (pg_lsn,pg_lsn) |
|
>= (pg_lsn,pg_lsn) |
|
range_inclusion_ops |
= (anyrange,anyrange) |
< (anyrange,anyrange) |
|
<= (anyrange,anyrange) |
|
>= (anyrange,anyrange) |
|
> (anyrange,anyrange) |
|
&& (anyrange,anyrange) |
|
@> (anyrange,anyelement) |
|
@> (anyrange,anyrange) |
|
<@ (anyrange,anyrange) |
|
<< (anyrange,anyrange) |
|
>> (anyrange,anyrange) |
|
&< (anyrange,anyrange) |
|
&> (anyrange,anyrange) |
|
-|- (anyrange,anyrange) |
|
text_bloom_ops |
= (text,text) |
text_minmax_ops |
= (text,text) |
< (text,text) |
|
<= (text,text) |
|
> (text,text) |
|
>= (text,text) |
|
tid_bloom_ops |
= (tid,tid) |
tid_minmax_ops |
= (tid,tid) |
< (tid,tid) |
|
> (tid,tid) |
|
<= (tid,tid) |
|
>= (tid,tid) |
|
tid_minmax_multi_ops |
= (tid,tid) |
< (tid,tid) |
|
> (tid,tid) |
|
<= (tid,tid) |
|
>= (tid,tid) |
|
timestamp_bloom_ops |
= (timestamp,timestamp) |
timestamp_minmax_ops |
= (timestamp,timestamp) |
< (timestamp,timestamp) |
|
<= (timestamp,timestamp) |
|
> (timestamp,timestamp) |
|
>= (timestamp,timestamp) |
|
timestamp_minmax_multi_ops |
= (timestamp,timestamp) |
< (timestamp,timestamp) |
|
<= (timestamp,timestamp) |
|
> (timestamp,timestamp) |
|
>= (timestamp,timestamp) |
|
timestamptz_bloom_ops |
= (timestamptz,timestamptz) |
timestamptz_minmax_ops |
= (timestamptz,timestamptz) |
< (timestamptz,timestamptz) |
|
<= (timestamptz,timestamptz) |
|
> (timestamptz,timestamptz) |
|
>= (timestamptz,timestamptz) |
|
timestamptz_minmax_multi_ops |
= (timestamptz,timestamptz) |
< (timestamptz,timestamptz) |
|
<= (timestamptz,timestamptz) |
|
> (timestamptz,timestamptz) |
|
>= (timestamptz,timestamptz) |
|
time_bloom_ops |
= (time,time) |
time_minmax_ops |
= (time,time) |
< (time,time) |
|
<= (time,time) |
|
> (time,time) |
|
>= (time,time) |
|
time_minmax_multi_ops |
= (time,time) |
< (time,time) |
|
<= (time,time) |
|
> (time,time) |
|
>= (time,time) |
|
timetz_bloom_ops |
= (timetz,timetz) |
timetz_minmax_ops |
= (timetz,timetz) |
< (timetz,timetz) |
|
<= (timetz,timetz) |
|
> (timetz,timetz) |
|
>= (timetz,timetz) |
|
timetz_minmax_multi_ops |
= (timetz,timetz) |
< (timetz,timetz) |
|
<= (timetz,timetz) |
|
> (timetz,timetz) |
|
>= (timetz,timetz) |
|
uuid_bloom_ops |
= (uuid,uuid) |
uuid_minmax_ops |
= (uuid,uuid) |
< (uuid,uuid) |
|
> (uuid,uuid) |
|
<= (uuid,uuid) |
|
>= (uuid,uuid) |
|
uuid_minmax_multi_ops |
= (uuid,uuid) |
< (uuid,uuid) |
|
> (uuid,uuid) |
|
<= (uuid,uuid) |
|
>= (uuid,uuid) |
|
varbit_minmax_ops |
= (varbit,varbit) |
< (varbit,varbit) |
|
> (varbit,varbit) |
|
<= (varbit,varbit) |
|
>= (varbit,varbit) |
一些内置算子类允许指定影响算子类行为的参数。每个算子类都有自己的一组允许的参数。只有 bloom
和 minmax-multi
算子类允许指定参数
bloom 算子类接受以下参数
n_distinct_per_range
定义块范围中估计的非空值的唯一数量,由 BRIN bloom 索引用于调整 Bloom 过滤器的尺寸。它的行为类似于 ALTER TABLE 的 n_distinct
选项。当设置为正值时,每个块范围都假定包含此数量的非空唯一值。当设置为负值(必须大于或等于 -1)时,非空唯一值的数量假定随块范围中可能的最大元组数(每个块约 290 行)线性增长。默认值为 -0.1
,非空唯一值的最小数量为 16
。
false_positive_rate
定义 BRIN bloom 索引用于调整 Bloom 过滤器的期望误报率。值必须介于 0.0001 和 0.25 之间。默认值为 0.01,即 1% 的误报率。
minmax-multi 算子类接受以下参数
values_per_range
定义 BRIN minmax 索引存储的最大值数量,以总结块范围。每个值可以表示一个点或一个区间的边界。值必须介于 8 和 256 之间,默认值为 32。