Add index-only scan support to btree_gist.

inet, cidr, and timetz indexes still cannot support index-only scans,
because they don't store the original unmodified value in the index, but a
derived approximate value.
This commit is contained in:
Heikki Linnakangas 2015-03-27 23:35:16 +02:00
parent 735cd6128a
commit e09b48316c
46 changed files with 614 additions and 51 deletions

View file

@ -9,7 +9,8 @@ OBJS = btree_gist.o btree_utils_num.o btree_utils_var.o btree_int2.o \
btree_numeric.o $(WIN32RES)
EXTENSION = btree_gist
DATA = btree_gist--1.0.sql btree_gist--unpackaged--1.0.sql
DATA = btree_gist--1.1.sql btree_gist--unpackaged--1.0.sql \
btree_gist--1.0--1.1.sql
PGFILEDESC = "btree_gist - B-tree equivalent GIST operator classes"
REGRESS = init int2 int4 int8 float4 float8 cash oid timestamp timestamptz \

View file

@ -17,6 +17,7 @@ typedef struct
** Cash ops
*/
PG_FUNCTION_INFO_V1(gbt_cash_compress);
PG_FUNCTION_INFO_V1(gbt_cash_fetch);
PG_FUNCTION_INFO_V1(gbt_cash_union);
PG_FUNCTION_INFO_V1(gbt_cash_picksplit);
PG_FUNCTION_INFO_V1(gbt_cash_consistent);
@ -123,6 +124,13 @@ gbt_cash_compress(PG_FUNCTION_ARGS)
PG_RETURN_POINTER(gbt_num_compress(entry, &tinfo));
}
Datum
gbt_cash_fetch(PG_FUNCTION_ARGS)
{
GISTENTRY *entry = (GISTENTRY *) PG_GETARG_POINTER(0);
PG_RETURN_POINTER(gbt_num_fetch(entry, &tinfo));
}
Datum
gbt_cash_consistent(PG_FUNCTION_ARGS)

View file

@ -17,6 +17,7 @@ typedef struct
** date ops
*/
PG_FUNCTION_INFO_V1(gbt_date_compress);
PG_FUNCTION_INFO_V1(gbt_date_fetch);
PG_FUNCTION_INFO_V1(gbt_date_union);
PG_FUNCTION_INFO_V1(gbt_date_picksplit);
PG_FUNCTION_INFO_V1(gbt_date_consistent);
@ -134,7 +135,13 @@ gbt_date_compress(PG_FUNCTION_ARGS)
PG_RETURN_POINTER(gbt_num_compress(entry, &tinfo));
}
Datum
gbt_date_fetch(PG_FUNCTION_ARGS)
{
GISTENTRY *entry = (GISTENTRY *) PG_GETARG_POINTER(0);
PG_RETURN_POINTER(gbt_num_fetch(entry, &tinfo));
}
Datum
gbt_date_consistent(PG_FUNCTION_ARGS)

View file

@ -16,6 +16,7 @@ typedef struct float4key
** float4 ops
*/
PG_FUNCTION_INFO_V1(gbt_float4_compress);
PG_FUNCTION_INFO_V1(gbt_float4_fetch);
PG_FUNCTION_INFO_V1(gbt_float4_union);
PG_FUNCTION_INFO_V1(gbt_float4_picksplit);
PG_FUNCTION_INFO_V1(gbt_float4_consistent);
@ -116,6 +117,13 @@ gbt_float4_compress(PG_FUNCTION_ARGS)
PG_RETURN_POINTER(gbt_num_compress(entry, &tinfo));
}
Datum
gbt_float4_fetch(PG_FUNCTION_ARGS)
{
GISTENTRY *entry = (GISTENTRY *) PG_GETARG_POINTER(0);
PG_RETURN_POINTER(gbt_num_fetch(entry, &tinfo));
}
Datum
gbt_float4_consistent(PG_FUNCTION_ARGS)

View file

@ -16,6 +16,7 @@ typedef struct float8key
** float8 ops
*/
PG_FUNCTION_INFO_V1(gbt_float8_compress);
PG_FUNCTION_INFO_V1(gbt_float8_fetch);
PG_FUNCTION_INFO_V1(gbt_float8_union);
PG_FUNCTION_INFO_V1(gbt_float8_picksplit);
PG_FUNCTION_INFO_V1(gbt_float8_consistent);
@ -123,6 +124,13 @@ gbt_float8_compress(PG_FUNCTION_ARGS)
PG_RETURN_POINTER(gbt_num_compress(entry, &tinfo));
}
Datum
gbt_float8_fetch(PG_FUNCTION_ARGS)
{
GISTENTRY *entry = (GISTENTRY *) PG_GETARG_POINTER(0);
PG_RETURN_POINTER(gbt_num_fetch(entry, &tinfo));
}
Datum
gbt_float8_consistent(PG_FUNCTION_ARGS)

View file

@ -0,0 +1,127 @@
/* contrib/btree_gist/btree_gist--1.0--1.1.sql */
-- complain if script is sourced in psql, rather than via CREATE EXTENSION
\echo Use "ALTER EXTENSION btree_gist UPDATE TO '1.1'" to load this file. \quit
-- Index-only scan support new in 9.5.
CREATE FUNCTION gbt_oid_fetch(internal)
RETURNS internal
AS 'MODULE_PATHNAME'
LANGUAGE C IMMUTABLE STRICT;
CREATE FUNCTION gbt_int2_fetch(internal)
RETURNS internal
AS 'MODULE_PATHNAME'
LANGUAGE C IMMUTABLE STRICT;
CREATE FUNCTION gbt_int4_fetch(internal)
RETURNS internal
AS 'MODULE_PATHNAME'
LANGUAGE C IMMUTABLE STRICT;
CREATE FUNCTION gbt_int8_fetch(internal)
RETURNS internal
AS 'MODULE_PATHNAME'
LANGUAGE C IMMUTABLE STRICT;
CREATE FUNCTION gbt_float4_fetch(internal)
RETURNS internal
AS 'MODULE_PATHNAME'
LANGUAGE C IMMUTABLE STRICT;
CREATE FUNCTION gbt_float8_fetch(internal)
RETURNS internal
AS 'MODULE_PATHNAME'
LANGUAGE C IMMUTABLE STRICT;
CREATE FUNCTION gbt_ts_fetch(internal)
RETURNS internal
AS 'MODULE_PATHNAME'
LANGUAGE C IMMUTABLE STRICT;
CREATE FUNCTION gbt_time_fetch(internal)
RETURNS internal
AS 'MODULE_PATHNAME'
LANGUAGE C IMMUTABLE STRICT;
CREATE FUNCTION gbt_date_fetch(internal)
RETURNS internal
AS 'MODULE_PATHNAME'
LANGUAGE C IMMUTABLE STRICT;
CREATE FUNCTION gbt_intv_fetch(internal)
RETURNS internal
AS 'MODULE_PATHNAME'
LANGUAGE C IMMUTABLE STRICT;
CREATE FUNCTION gbt_cash_fetch(internal)
RETURNS internal
AS 'MODULE_PATHNAME'
LANGUAGE C IMMUTABLE STRICT;
CREATE FUNCTION gbt_macad_fetch(internal)
RETURNS internal
AS 'MODULE_PATHNAME'
LANGUAGE C IMMUTABLE STRICT;
CREATE FUNCTION gbt_var_fetch(internal)
RETURNS internal
AS 'MODULE_PATHNAME'
LANGUAGE C IMMUTABLE STRICT;
ALTER OPERATOR FAMILY gist_oid_ops USING gist ADD
FUNCTION 9 (oid, oid) gbt_oid_fetch (internal) ;
ALTER OPERATOR FAMILY gist_int2_ops USING gist ADD
FUNCTION 9 (int2, int2) gbt_int2_fetch (internal) ;
ALTER OPERATOR FAMILY gist_int4_ops USING gist ADD
FUNCTION 9 (int4, int4) gbt_int4_fetch (internal) ;
ALTER OPERATOR FAMILY gist_int8_ops USING gist ADD
FUNCTION 9 (int8, int8) gbt_int8_fetch (internal) ;
ALTER OPERATOR FAMILY gist_float4_ops USING gist ADD
FUNCTION 9 (float4, float4) gbt_float4_fetch (internal) ;
ALTER OPERATOR FAMILY gist_float8_ops USING gist ADD
FUNCTION 9 (float8, float8) gbt_float8_fetch (internal) ;
ALTER OPERATOR FAMILY gist_timestamp_ops USING gist ADD
FUNCTION 9 (timestamp, timestamp) gbt_ts_fetch (internal) ;
ALTER OPERATOR FAMILY gist_timestamptz_ops USING gist ADD
FUNCTION 9 (timestamptz, timestamptz) gbt_ts_fetch (internal) ;
ALTER OPERATOR FAMILY gist_time_ops USING gist ADD
FUNCTION 9 (time, time) gbt_time_fetch (internal) ;
ALTER OPERATOR FAMILY gist_date_ops USING gist ADD
FUNCTION 9 (date, date) gbt_date_fetch (internal) ;
ALTER OPERATOR FAMILY gist_interval_ops USING gist ADD
FUNCTION 9 (interval, interval) gbt_intv_fetch (internal) ;
ALTER OPERATOR FAMILY gist_cash_ops USING gist ADD
FUNCTION 9 (money, money) gbt_cash_fetch (internal) ;
ALTER OPERATOR FAMILY gist_macaddr_ops USING gist ADD
FUNCTION 9 (macaddr, macaddr) gbt_macad_fetch (internal) ;
ALTER OPERATOR FAMILY gist_text_ops USING gist ADD
FUNCTION 9 (text, text) gbt_var_fetch (internal) ;
ALTER OPERATOR FAMILY gist_bpchar_ops USING gist ADD
FUNCTION 9 (bpchar, bpchar) gbt_var_fetch (internal) ;
ALTER OPERATOR FAMILY gist_bytea_ops USING gist ADD
FUNCTION 9 (bytea, bytea) gbt_var_fetch (internal) ;
ALTER OPERATOR FAMILY gist_numeric_ops USING gist ADD
FUNCTION 9 (numeric, numeric) gbt_var_fetch (internal) ;
ALTER OPERATOR FAMILY gist_bit_ops USING gist ADD
FUNCTION 9 (bit, bit) gbt_var_fetch (internal) ;
ALTER OPERATOR FAMILY gist_vbit_ops USING gist ADD
FUNCTION 9 (varbit, varbit) gbt_var_fetch (internal) ;

View file

@ -249,6 +249,11 @@ RETURNS float8
AS 'MODULE_PATHNAME'
LANGUAGE C IMMUTABLE STRICT;
CREATE FUNCTION gbt_oid_fetch(internal)
RETURNS internal
AS 'MODULE_PATHNAME'
LANGUAGE C IMMUTABLE STRICT;
CREATE FUNCTION gbt_oid_compress(internal)
RETURNS internal
AS 'MODULE_PATHNAME'
@ -264,6 +269,11 @@ RETURNS internal
AS 'MODULE_PATHNAME'
LANGUAGE C IMMUTABLE STRICT;
CREATE FUNCTION gbt_var_fetch(internal)
RETURNS internal
AS 'MODULE_PATHNAME'
LANGUAGE C IMMUTABLE STRICT;
CREATE FUNCTION gbt_oid_penalty(internal,internal,internal)
RETURNS internal
AS 'MODULE_PATHNAME'
@ -305,11 +315,12 @@ AS
-- Add operators that are new in 9.1. We do it like this, leaving them
-- "loose" in the operator family rather than bound into the opclass, because
-- that's the only state that can be reproduced during an upgrade from 9.0.
ALTER OPERATOR FAMILY gist_oid_ops USING gist ADD
OPERATOR 6 <> (oid, oid) ,
OPERATOR 15 <-> (oid, oid) FOR ORDER BY pg_catalog.oid_ops ,
FUNCTION 8 (oid, oid) gbt_oid_distance (internal, oid, int2, oid) ;
FUNCTION 8 (oid, oid) gbt_oid_distance (internal, oid, int2, oid) ,
-- Also add support function for index-only-scans, added in 9.5.
FUNCTION 9 (oid, oid) gbt_oid_fetch (internal) ;
--
@ -335,6 +346,11 @@ RETURNS internal
AS 'MODULE_PATHNAME'
LANGUAGE C IMMUTABLE STRICT;
CREATE FUNCTION gbt_int2_fetch(internal)
RETURNS internal
AS 'MODULE_PATHNAME'
LANGUAGE C IMMUTABLE STRICT;
CREATE FUNCTION gbt_int2_penalty(internal,internal,internal)
RETURNS internal
AS 'MODULE_PATHNAME'
@ -376,8 +392,8 @@ AS
ALTER OPERATOR FAMILY gist_int2_ops USING gist ADD
OPERATOR 6 <> (int2, int2) ,
OPERATOR 15 <-> (int2, int2) FOR ORDER BY pg_catalog.integer_ops ,
FUNCTION 8 (int2, int2) gbt_int2_distance (internal, int2, int2, oid) ;
FUNCTION 8 (int2, int2) gbt_int2_distance (internal, int2, int2, oid) ,
FUNCTION 9 (int2, int2) gbt_int2_fetch (internal) ;
--
--
@ -402,6 +418,11 @@ RETURNS internal
AS 'MODULE_PATHNAME'
LANGUAGE C IMMUTABLE STRICT;
CREATE FUNCTION gbt_int4_fetch(internal)
RETURNS internal
AS 'MODULE_PATHNAME'
LANGUAGE C IMMUTABLE STRICT;
CREATE FUNCTION gbt_int4_penalty(internal,internal,internal)
RETURNS internal
AS 'MODULE_PATHNAME'
@ -443,7 +464,8 @@ AS
ALTER OPERATOR FAMILY gist_int4_ops USING gist ADD
OPERATOR 6 <> (int4, int4) ,
OPERATOR 15 <-> (int4, int4) FOR ORDER BY pg_catalog.integer_ops ,
FUNCTION 8 (int4, int4) gbt_int4_distance (internal, int4, int2, oid) ;
FUNCTION 8 (int4, int4) gbt_int4_distance (internal, int4, int2, oid) ,
FUNCTION 9 (int4, int4) gbt_int4_fetch (internal) ;
--
@ -469,6 +491,11 @@ RETURNS internal
AS 'MODULE_PATHNAME'
LANGUAGE C IMMUTABLE STRICT;
CREATE FUNCTION gbt_int8_fetch(internal)
RETURNS internal
AS 'MODULE_PATHNAME'
LANGUAGE C IMMUTABLE STRICT;
CREATE FUNCTION gbt_int8_penalty(internal,internal,internal)
RETURNS internal
AS 'MODULE_PATHNAME'
@ -510,8 +537,8 @@ AS
ALTER OPERATOR FAMILY gist_int8_ops USING gist ADD
OPERATOR 6 <> (int8, int8) ,
OPERATOR 15 <-> (int8, int8) FOR ORDER BY pg_catalog.integer_ops ,
FUNCTION 8 (int8, int8) gbt_int8_distance (internal, int8, int2, oid) ;
FUNCTION 8 (int8, int8) gbt_int8_distance (internal, int8, int2, oid) ,
FUNCTION 9 (int8, int8) gbt_int8_fetch (internal) ;
--
--
@ -536,6 +563,11 @@ RETURNS internal
AS 'MODULE_PATHNAME'
LANGUAGE C IMMUTABLE STRICT;
CREATE FUNCTION gbt_float4_fetch(internal)
RETURNS internal
AS 'MODULE_PATHNAME'
LANGUAGE C IMMUTABLE STRICT;
CREATE FUNCTION gbt_float4_penalty(internal,internal,internal)
RETURNS internal
AS 'MODULE_PATHNAME'
@ -577,8 +609,8 @@ AS
ALTER OPERATOR FAMILY gist_float4_ops USING gist ADD
OPERATOR 6 <> (float4, float4) ,
OPERATOR 15 <-> (float4, float4) FOR ORDER BY pg_catalog.float_ops ,
FUNCTION 8 (float4, float4) gbt_float4_distance (internal, float4, int2, oid) ;
FUNCTION 8 (float4, float4) gbt_float4_distance (internal, float4, int2, oid) ,
FUNCTION 9 (float4, float4) gbt_float4_fetch (internal) ;
--
--
@ -603,6 +635,11 @@ RETURNS internal
AS 'MODULE_PATHNAME'
LANGUAGE C IMMUTABLE STRICT;
CREATE FUNCTION gbt_float8_fetch(internal)
RETURNS internal
AS 'MODULE_PATHNAME'
LANGUAGE C IMMUTABLE STRICT;
CREATE FUNCTION gbt_float8_penalty(internal,internal,internal)
RETURNS internal
AS 'MODULE_PATHNAME'
@ -644,8 +681,8 @@ AS
ALTER OPERATOR FAMILY gist_float8_ops USING gist ADD
OPERATOR 6 <> (float8, float8) ,
OPERATOR 15 <-> (float8, float8) FOR ORDER BY pg_catalog.float_ops ,
FUNCTION 8 (float8, float8) gbt_float8_distance (internal, float8, int2, oid) ;
FUNCTION 8 (float8, float8) gbt_float8_distance (internal, float8, int2, oid) ,
FUNCTION 9 (float8, float8) gbt_float8_fetch (internal) ;
--
--
@ -685,6 +722,11 @@ RETURNS internal
AS 'MODULE_PATHNAME'
LANGUAGE C IMMUTABLE STRICT;
CREATE FUNCTION gbt_ts_fetch(internal)
RETURNS internal
AS 'MODULE_PATHNAME'
LANGUAGE C IMMUTABLE STRICT;
CREATE FUNCTION gbt_ts_penalty(internal,internal,internal)
RETURNS internal
AS 'MODULE_PATHNAME'
@ -726,8 +768,8 @@ AS
ALTER OPERATOR FAMILY gist_timestamp_ops USING gist ADD
OPERATOR 6 <> (timestamp, timestamp) ,
OPERATOR 15 <-> (timestamp, timestamp) FOR ORDER BY pg_catalog.interval_ops ,
FUNCTION 8 (timestamp, timestamp) gbt_ts_distance (internal, timestamp, int2, oid) ;
FUNCTION 8 (timestamp, timestamp) gbt_ts_distance (internal, timestamp, int2, oid) ,
FUNCTION 9 (timestamp, timestamp) gbt_ts_fetch (internal) ;
-- Create the operator class
CREATE OPERATOR CLASS gist_timestamptz_ops
@ -750,8 +792,8 @@ AS
ALTER OPERATOR FAMILY gist_timestamptz_ops USING gist ADD
OPERATOR 6 <> (timestamptz, timestamptz) ,
OPERATOR 15 <-> (timestamptz, timestamptz) FOR ORDER BY pg_catalog.interval_ops ,
FUNCTION 8 (timestamptz, timestamptz) gbt_tstz_distance (internal, timestamptz, int2, oid) ;
FUNCTION 8 (timestamptz, timestamptz) gbt_tstz_distance (internal, timestamptz, int2, oid) ,
FUNCTION 9 (timestamptz, timestamptz) gbt_ts_fetch (internal) ;
--
--
@ -786,6 +828,11 @@ RETURNS internal
AS 'MODULE_PATHNAME'
LANGUAGE C IMMUTABLE STRICT;
CREATE FUNCTION gbt_time_fetch(internal)
RETURNS internal
AS 'MODULE_PATHNAME'
LANGUAGE C IMMUTABLE STRICT;
CREATE FUNCTION gbt_time_penalty(internal,internal,internal)
RETURNS internal
AS 'MODULE_PATHNAME'
@ -827,7 +874,8 @@ AS
ALTER OPERATOR FAMILY gist_time_ops USING gist ADD
OPERATOR 6 <> (time, time) ,
OPERATOR 15 <-> (time, time) FOR ORDER BY pg_catalog.interval_ops ,
FUNCTION 8 (time, time) gbt_time_distance (internal, time, int2, oid) ;
FUNCTION 8 (time, time) gbt_time_distance (internal, time, int2, oid) ,
FUNCTION 9 (time, time) gbt_time_fetch (internal) ;
CREATE OPERATOR CLASS gist_timetz_ops
@ -849,6 +897,7 @@ AS
ALTER OPERATOR FAMILY gist_timetz_ops USING gist ADD
OPERATOR 6 <> (timetz, timetz) ;
-- no 'fetch' function, as the compress function is lossy.
--
@ -874,6 +923,11 @@ RETURNS internal
AS 'MODULE_PATHNAME'
LANGUAGE C IMMUTABLE STRICT;
CREATE FUNCTION gbt_date_fetch(internal)
RETURNS internal
AS 'MODULE_PATHNAME'
LANGUAGE C IMMUTABLE STRICT;
CREATE FUNCTION gbt_date_penalty(internal,internal,internal)
RETURNS internal
AS 'MODULE_PATHNAME'
@ -915,7 +969,8 @@ AS
ALTER OPERATOR FAMILY gist_date_ops USING gist ADD
OPERATOR 6 <> (date, date) ,
OPERATOR 15 <-> (date, date) FOR ORDER BY pg_catalog.integer_ops ,
FUNCTION 8 (date, date) gbt_date_distance (internal, date, int2, oid) ;
FUNCTION 8 (date, date) gbt_date_distance (internal, date, int2, oid) ,
FUNCTION 9 (date, date) gbt_date_fetch (internal) ;
--
@ -946,6 +1001,11 @@ RETURNS internal
AS 'MODULE_PATHNAME'
LANGUAGE C IMMUTABLE STRICT;
CREATE FUNCTION gbt_intv_fetch(internal)
RETURNS internal
AS 'MODULE_PATHNAME'
LANGUAGE C IMMUTABLE STRICT;
CREATE FUNCTION gbt_intv_penalty(internal,internal,internal)
RETURNS internal
AS 'MODULE_PATHNAME'
@ -987,7 +1047,8 @@ AS
ALTER OPERATOR FAMILY gist_interval_ops USING gist ADD
OPERATOR 6 <> (interval, interval) ,
OPERATOR 15 <-> (interval, interval) FOR ORDER BY pg_catalog.interval_ops ,
FUNCTION 8 (interval, interval) gbt_intv_distance (internal, interval, int2, oid) ;
FUNCTION 8 (interval, interval) gbt_intv_distance (internal, interval, int2, oid) ,
FUNCTION 9 (interval, interval) gbt_intv_fetch (internal) ;
--
@ -1013,6 +1074,11 @@ RETURNS internal
AS 'MODULE_PATHNAME'
LANGUAGE C IMMUTABLE STRICT;
CREATE FUNCTION gbt_cash_fetch(internal)
RETURNS internal
AS 'MODULE_PATHNAME'
LANGUAGE C IMMUTABLE STRICT;
CREATE FUNCTION gbt_cash_penalty(internal,internal,internal)
RETURNS internal
AS 'MODULE_PATHNAME'
@ -1054,7 +1120,8 @@ AS
ALTER OPERATOR FAMILY gist_cash_ops USING gist ADD
OPERATOR 6 <> (money, money) ,
OPERATOR 15 <-> (money, money) FOR ORDER BY pg_catalog.money_ops ,
FUNCTION 8 (money, money) gbt_cash_distance (internal, money, int2, oid) ;
FUNCTION 8 (money, money) gbt_cash_distance (internal, money, int2, oid) ,
FUNCTION 9 (money, money) gbt_cash_fetch (internal) ;
--
@ -1075,6 +1142,11 @@ RETURNS internal
AS 'MODULE_PATHNAME'
LANGUAGE C IMMUTABLE STRICT;
CREATE FUNCTION gbt_macad_fetch(internal)
RETURNS internal
AS 'MODULE_PATHNAME'
LANGUAGE C IMMUTABLE STRICT;
CREATE FUNCTION gbt_macad_penalty(internal,internal,internal)
RETURNS internal
AS 'MODULE_PATHNAME'
@ -1114,7 +1186,8 @@ AS
STORAGE gbtreekey16;
ALTER OPERATOR FAMILY gist_macaddr_ops USING gist ADD
OPERATOR 6 <> (macaddr, macaddr) ;
OPERATOR 6 <> (macaddr, macaddr) ,
FUNCTION 9 (macaddr, macaddr) gbt_macad_fetch (internal);
--
@ -1184,7 +1257,8 @@ AS
STORAGE gbtreekey_var;
ALTER OPERATOR FAMILY gist_text_ops USING gist ADD
OPERATOR 6 <> (text, text) ;
OPERATOR 6 <> (text, text) ,
FUNCTION 9 (text, text) gbt_var_fetch (internal) ;
---- Create the operator class
@ -1206,8 +1280,8 @@ AS
STORAGE gbtreekey_var;
ALTER OPERATOR FAMILY gist_bpchar_ops USING gist ADD
OPERATOR 6 <> (bpchar, bpchar) ;
OPERATOR 6 <> (bpchar, bpchar) ,
FUNCTION 9 (bpchar, bpchar) gbt_var_fetch (internal) ;
--
--
@ -1265,7 +1339,8 @@ AS
STORAGE gbtreekey_var;
ALTER OPERATOR FAMILY gist_bytea_ops USING gist ADD
OPERATOR 6 <> (bytea, bytea) ;
OPERATOR 6 <> (bytea, bytea) ,
FUNCTION 9 (bytea, bytea) gbt_var_fetch (internal) ;
--
@ -1325,7 +1400,8 @@ AS
STORAGE gbtreekey_var;
ALTER OPERATOR FAMILY gist_numeric_ops USING gist ADD
OPERATOR 6 <> (numeric, numeric) ;
OPERATOR 6 <> (numeric, numeric) ,
FUNCTION 9 (numeric, numeric) gbt_var_fetch (internal) ;
--
@ -1384,7 +1460,8 @@ AS
STORAGE gbtreekey_var;
ALTER OPERATOR FAMILY gist_bit_ops USING gist ADD
OPERATOR 6 <> (bit, bit) ;
OPERATOR 6 <> (bit, bit) ,
FUNCTION 9 (bit, bit) gbt_var_fetch (internal) ;
-- Create the operator class
@ -1406,7 +1483,8 @@ AS
STORAGE gbtreekey_var;
ALTER OPERATOR FAMILY gist_vbit_ops USING gist ADD
OPERATOR 6 <> (varbit, varbit) ;
OPERATOR 6 <> (varbit, varbit) ,
FUNCTION 9 (varbit, varbit) gbt_var_fetch (internal) ;
--
@ -1467,7 +1545,7 @@ AS
ALTER OPERATOR FAMILY gist_inet_ops USING gist ADD
OPERATOR 6 <> (inet, inet) ;
-- no fetch support, the compress function is lossy
-- Create the operator class
CREATE OPERATOR CLASS gist_cidr_ops
@ -1489,3 +1567,4 @@ AS
ALTER OPERATOR FAMILY gist_cidr_ops USING gist ADD
OPERATOR 6 <> (inet, inet) ;
-- no fetch support, the compress function is lossy

View file

@ -1,5 +1,5 @@
# btree_gist extension
comment = 'support for indexing common datatypes in GiST'
default_version = '1.0'
default_version = '1.1'
module_pathname = '$libdir/btree_gist'
relocatable = true

View file

@ -16,6 +16,7 @@ typedef struct int16key
** int16 ops
*/
PG_FUNCTION_INFO_V1(gbt_int2_compress);
PG_FUNCTION_INFO_V1(gbt_int2_fetch);
PG_FUNCTION_INFO_V1(gbt_int2_union);
PG_FUNCTION_INFO_V1(gbt_int2_picksplit);
PG_FUNCTION_INFO_V1(gbt_int2_consistent);
@ -123,6 +124,13 @@ gbt_int2_compress(PG_FUNCTION_ARGS)
PG_RETURN_POINTER(gbt_num_compress(entry, &tinfo));
}
Datum
gbt_int2_fetch(PG_FUNCTION_ARGS)
{
GISTENTRY *entry = (GISTENTRY *) PG_GETARG_POINTER(0);
PG_RETURN_POINTER(gbt_num_fetch(entry, &tinfo));
}
Datum
gbt_int2_consistent(PG_FUNCTION_ARGS)

View file

@ -16,6 +16,7 @@ typedef struct int32key
** int32 ops
*/
PG_FUNCTION_INFO_V1(gbt_int4_compress);
PG_FUNCTION_INFO_V1(gbt_int4_fetch);
PG_FUNCTION_INFO_V1(gbt_int4_union);
PG_FUNCTION_INFO_V1(gbt_int4_picksplit);
PG_FUNCTION_INFO_V1(gbt_int4_consistent);
@ -124,6 +125,13 @@ gbt_int4_compress(PG_FUNCTION_ARGS)
PG_RETURN_POINTER(gbt_num_compress(entry, &tinfo));
}
Datum
gbt_int4_fetch(PG_FUNCTION_ARGS)
{
GISTENTRY *entry = (GISTENTRY *) PG_GETARG_POINTER(0);
PG_RETURN_POINTER(gbt_num_fetch(entry, &tinfo));
}
Datum
gbt_int4_consistent(PG_FUNCTION_ARGS)

View file

@ -16,6 +16,7 @@ typedef struct int64key
** int64 ops
*/
PG_FUNCTION_INFO_V1(gbt_int8_compress);
PG_FUNCTION_INFO_V1(gbt_int8_fetch);
PG_FUNCTION_INFO_V1(gbt_int8_union);
PG_FUNCTION_INFO_V1(gbt_int8_picksplit);
PG_FUNCTION_INFO_V1(gbt_int8_consistent);
@ -124,6 +125,13 @@ gbt_int8_compress(PG_FUNCTION_ARGS)
PG_RETURN_POINTER(gbt_num_compress(entry, &tinfo));
}
Datum
gbt_int8_fetch(PG_FUNCTION_ARGS)
{
GISTENTRY *entry = (GISTENTRY *) PG_GETARG_POINTER(0);
PG_RETURN_POINTER(gbt_num_fetch(entry, &tinfo));
}
Datum
gbt_int8_consistent(PG_FUNCTION_ARGS)

View file

@ -18,6 +18,7 @@ typedef struct
** Interval ops
*/
PG_FUNCTION_INFO_V1(gbt_intv_compress);
PG_FUNCTION_INFO_V1(gbt_intv_fetch);
PG_FUNCTION_INFO_V1(gbt_intv_decompress);
PG_FUNCTION_INFO_V1(gbt_intv_union);
PG_FUNCTION_INFO_V1(gbt_intv_picksplit);
@ -174,6 +175,14 @@ gbt_intv_compress(PG_FUNCTION_ARGS)
}
Datum
gbt_intv_fetch(PG_FUNCTION_ARGS)
{
GISTENTRY *entry = (GISTENTRY *) PG_GETARG_POINTER(0);
PG_RETURN_POINTER(gbt_num_fetch(entry, &tinfo));
}
Datum
gbt_intv_decompress(PG_FUNCTION_ARGS)
{

View file

@ -19,6 +19,7 @@ typedef struct
** OID ops
*/
PG_FUNCTION_INFO_V1(gbt_macad_compress);
PG_FUNCTION_INFO_V1(gbt_macad_fetch);
PG_FUNCTION_INFO_V1(gbt_macad_union);
PG_FUNCTION_INFO_V1(gbt_macad_picksplit);
PG_FUNCTION_INFO_V1(gbt_macad_consistent);
@ -114,6 +115,13 @@ gbt_macad_compress(PG_FUNCTION_ARGS)
PG_RETURN_POINTER(gbt_num_compress(entry, &tinfo));
}
Datum
gbt_macad_fetch(PG_FUNCTION_ARGS)
{
GISTENTRY *entry = (GISTENTRY *) PG_GETARG_POINTER(0);
PG_RETURN_POINTER(gbt_num_fetch(entry, &tinfo));
}
Datum
gbt_macad_consistent(PG_FUNCTION_ARGS)

View file

@ -16,6 +16,7 @@ typedef struct
** OID ops
*/
PG_FUNCTION_INFO_V1(gbt_oid_compress);
PG_FUNCTION_INFO_V1(gbt_oid_fetch);
PG_FUNCTION_INFO_V1(gbt_oid_union);
PG_FUNCTION_INFO_V1(gbt_oid_picksplit);
PG_FUNCTION_INFO_V1(gbt_oid_consistent);
@ -124,6 +125,13 @@ gbt_oid_compress(PG_FUNCTION_ARGS)
PG_RETURN_POINTER(gbt_num_compress(entry, &tinfo));
}
Datum
gbt_oid_fetch(PG_FUNCTION_ARGS)
{
GISTENTRY *entry = (GISTENTRY *) PG_GETARG_POINTER(0);
PG_RETURN_POINTER(gbt_num_fetch(entry, &tinfo));
}
Datum
gbt_oid_consistent(PG_FUNCTION_ARGS)

View file

@ -19,6 +19,7 @@ typedef struct
*/
PG_FUNCTION_INFO_V1(gbt_time_compress);
PG_FUNCTION_INFO_V1(gbt_timetz_compress);
PG_FUNCTION_INFO_V1(gbt_time_fetch);
PG_FUNCTION_INFO_V1(gbt_time_union);
PG_FUNCTION_INFO_V1(gbt_time_picksplit);
PG_FUNCTION_INFO_V1(gbt_time_consistent);
@ -192,6 +193,13 @@ gbt_timetz_compress(PG_FUNCTION_ARGS)
PG_RETURN_POINTER(retval);
}
Datum
gbt_time_fetch(PG_FUNCTION_ARGS)
{
GISTENTRY *entry = (GISTENTRY *) PG_GETARG_POINTER(0);
PG_RETURN_POINTER(gbt_num_fetch(entry, &tinfo));
}
Datum
gbt_time_consistent(PG_FUNCTION_ARGS)

View file

@ -19,6 +19,7 @@ typedef struct
*/
PG_FUNCTION_INFO_V1(gbt_ts_compress);
PG_FUNCTION_INFO_V1(gbt_tstz_compress);
PG_FUNCTION_INFO_V1(gbt_ts_fetch);
PG_FUNCTION_INFO_V1(gbt_ts_union);
PG_FUNCTION_INFO_V1(gbt_ts_picksplit);
PG_FUNCTION_INFO_V1(gbt_ts_consistent);
@ -243,6 +244,13 @@ gbt_tstz_compress(PG_FUNCTION_ARGS)
PG_RETURN_POINTER(retval);
}
Datum
gbt_ts_fetch(PG_FUNCTION_ARGS)
{
GISTENTRY *entry = (GISTENTRY *) PG_GETARG_POINTER(0);
PG_RETURN_POINTER(gbt_num_fetch(entry, &tinfo));
}
Datum
gbt_ts_consistent(PG_FUNCTION_ARGS)

View file

@ -93,6 +93,64 @@ gbt_num_compress(GISTENTRY *entry, const gbtree_ninfo *tinfo)
return retval;
}
/*
* Convert a compressed leaf item back to the original type, for index-only
* scans.
*/
GISTENTRY *
gbt_num_fetch(GISTENTRY *entry, const gbtree_ninfo *tinfo)
{
GISTENTRY *retval;
Datum datum;
Assert(tinfo->indexsize >= 2 * tinfo->size);
/*
* Get the original Datum from the stored datum. On leaf entries, the
* lower and upper bound are the same. We just grab the lower bound and
* return it.
*/
switch (tinfo->t)
{
case gbt_t_int2:
datum = Int16GetDatum(*(int16 *) entry->key);
break;
case gbt_t_int4:
datum = Int32GetDatum(*(int32 *) entry->key);
break;
case gbt_t_int8:
datum = Int64GetDatum(*(int64 *) entry->key);
break;
case gbt_t_oid:
datum = ObjectIdGetDatum(*(Oid *) entry->key);
break;
case gbt_t_float4:
datum = Float4GetDatum(*(float4 *) entry->key);
break;
case gbt_t_float8:
datum = Float8GetDatum(*(float8 *) entry->key);
break;
case gbt_t_date:
datum = DateADTGetDatum(*(DateADT *) entry->key);
break;
case gbt_t_time:
datum = TimeADTGetDatum(*(TimeADT *) entry->key);
break;
case gbt_t_ts:
datum = TimestampGetDatum(*(Timestamp *) entry->key);
break;
case gbt_t_cash:
datum = CashGetDatum(*(Cash *) entry->key);
break;
default:
datum = PointerGetDatum(entry->key);
}
retval = palloc(sizeof(GISTENTRY));
gistentryinit(*retval, datum, entry->rel, entry->page, entry->offset,
FALSE);
return retval;
}

View file

@ -130,6 +130,7 @@ extern GIST_SPLITVEC *gbt_num_picksplit(const GistEntryVector *entryvec, GIST_SP
extern GISTENTRY *gbt_num_compress(GISTENTRY *entry, const gbtree_ninfo *tinfo);
extern GISTENTRY *gbt_num_fetch(GISTENTRY *entry, const gbtree_ninfo *tinfo);
extern void *gbt_num_union(GBT_NUMKEY *out, const GistEntryVector *entryvec,
const gbtree_ninfo *tinfo);

View file

@ -29,6 +29,7 @@ typedef struct
PG_FUNCTION_INFO_V1(gbt_var_decompress);
PG_FUNCTION_INFO_V1(gbt_var_fetch);
Datum
@ -301,6 +302,23 @@ gbt_var_compress(GISTENTRY *entry, const gbtree_vinfo *tinfo)
}
Datum
gbt_var_fetch(PG_FUNCTION_ARGS)
{
GISTENTRY *entry = (GISTENTRY *) PG_GETARG_POINTER(0);
GBT_VARKEY *key = (GBT_VARKEY *) DatumGetPointer(PG_DETOAST_DATUM(entry->key));
GBT_VARKEY_R r = gbt_var_key_readable(key);
GISTENTRY *retval;
retval = palloc(sizeof(GISTENTRY));
gistentryinit(*retval, PointerGetDatum(r.lower),
entry->rel, entry->page,
entry->offset, TRUE);
PG_RETURN_POINTER(retval);
}
GBT_VARKEY *
gbt_var_union(const GistEntryVector *entryvec, int32 *size, Oid collation,
const gbtree_vinfo *tinfo)

View file

@ -64,3 +64,13 @@ SELECT count(*) FROM bittmp WHERE a > '011011000100010111011000110000100';
350
(1 row)
-- Test index-only scans
SET enable_bitmapscan=off;
EXPLAIN (COSTS OFF)
SELECT a FROM bittmp WHERE a BETWEEN '1000000' and '1000001';
QUERY PLAN
-----------------------------------------------------------------------
Index Only Scan using bitidx on bittmp
Index Cond: ((a >= B'1000000'::"bit") AND (a <= B'1000001'::"bit"))
(2 rows)

View file

@ -71,3 +71,20 @@ SELECT count(*) FROM byteatmp WHERE a = '2eb2c961c1cbf6 cf8d7b68cb9a2f36 7bbed
1
(1 row)
-- Test index-only scans
SET enable_bitmapscan=off;
EXPLAIN (COSTS OFF)
SELECT a FROM byteatmp where a > 'ffa'::bytea;
QUERY PLAN
--------------------------------------------
Index Only Scan using byteaidx on byteatmp
Index Cond: (a > '\x666661'::bytea)
(2 rows)
SELECT a FROM byteatmp where a > 'ffa'::bytea;
a
--------------------------------
\x666662656532373363376262
\x6666626663313331336339633835
(2 rows)

View file

@ -74,10 +74,10 @@ SELECT count(*) FROM moneytmp WHERE a > '22649.64'::money;
EXPLAIN (COSTS OFF)
SELECT a, a <-> '21472.79' FROM moneytmp ORDER BY a <-> '21472.79' LIMIT 3;
QUERY PLAN
-----------------------------------------------
QUERY PLAN
--------------------------------------------------
Limit
-> Index Scan using moneyidx on moneytmp
-> Index Only Scan using moneyidx on moneytmp
Order By: (a <-> '$21,472.79'::money)
(3 rows)

View file

@ -64,3 +64,19 @@ SELECT count(*) FROM chartmp WHERE a > '31b0'::char(32);
400
(1 row)
-- Test index-only scans
SET enable_bitmapscan=off;
EXPLAIN (COSTS OFF)
SELECT * FROM chartmp WHERE a BETWEEN '31a' AND '31c';
QUERY PLAN
---------------------------------------------------------------
Index Only Scan using charidx on chartmp
Index Cond: ((a >= '31a'::bpchar) AND (a <= '31c'::bpchar))
(2 rows)
SELECT * FROM chartmp WHERE a BETWEEN '31a' AND '31c';
a
------
31b0
(1 row)

View file

@ -64,3 +64,19 @@ SELECT count(*) FROM chartmp WHERE a > '31b0'::char(32);
214
(1 row)
-- Test index-only scans
SET enable_bitmapscan=off;
EXPLAIN (COSTS OFF)
SELECT * FROM chartmp WHERE a BETWEEN '31a' AND '31c';
QUERY PLAN
---------------------------------------------------------------
Index Only Scan using charidx on chartmp
Index Cond: ((a >= '31a'::bpchar) AND (a <= '31c'::bpchar))
(2 rows)
SELECT * FROM chartmp WHERE a BETWEEN '31a' AND '31c';
a
------
31b0
(1 row)

View file

@ -74,10 +74,10 @@ SELECT count(*) FROM datetmp WHERE a > '2001-02-13'::date;
EXPLAIN (COSTS OFF)
SELECT a, a <-> '2001-02-13' FROM datetmp ORDER BY a <-> '2001-02-13' LIMIT 3;
QUERY PLAN
----------------------------------------------
QUERY PLAN
------------------------------------------------
Limit
-> Index Scan using dateidx on datetmp
-> Index Only Scan using dateidx on datetmp
Order By: (a <-> '02-13-2001'::date)
(3 rows)

View file

@ -74,10 +74,10 @@ SELECT count(*) FROM float4tmp WHERE a > -179.0::float4;
EXPLAIN (COSTS OFF)
SELECT a, a <-> '-179.0' FROM float4tmp ORDER BY a <-> '-179.0' LIMIT 3;
QUERY PLAN
-----------------------------------------------
QUERY PLAN
----------------------------------------------------
Limit
-> Index Scan using float4idx on float4tmp
-> Index Only Scan using float4idx on float4tmp
Order By: (a <-> (-179)::real)
(3 rows)

View file

@ -77,7 +77,7 @@ SELECT a, a <-> '-1890.0' FROM float8tmp ORDER BY a <-> '-1890.0' LIMIT 3;
QUERY PLAN
-----------------------------------------------------
Limit
-> Index Scan using float8idx on float8tmp
-> Index Only Scan using float8idx on float8tmp
Order By: (a <-> (-1890)::double precision)
(3 rows)

View file

@ -74,10 +74,10 @@ SELECT count(*) FROM int2tmp WHERE a > 237::int2;
EXPLAIN (COSTS OFF)
SELECT a, a <-> '237' FROM int2tmp ORDER BY a <-> '237' LIMIT 3;
QUERY PLAN
-------------------------------------------
QUERY PLAN
------------------------------------------------
Limit
-> Index Scan using int2idx on int2tmp
-> Index Only Scan using int2idx on int2tmp
Order By: (a <-> 237::smallint)
(3 rows)

View file

@ -74,10 +74,10 @@ SELECT count(*) FROM int4tmp WHERE a > 237::int4;
EXPLAIN (COSTS OFF)
SELECT a, a <-> '237' FROM int4tmp ORDER BY a <-> '237' LIMIT 3;
QUERY PLAN
-------------------------------------------
QUERY PLAN
------------------------------------------------
Limit
-> Index Scan using int4idx on int4tmp
-> Index Only Scan using int4idx on int4tmp
Order By: (a <-> 237)
(3 rows)

View file

@ -77,7 +77,7 @@ SELECT a, a <-> '464571291354841' FROM int8tmp ORDER BY a <-> '464571291354841'
QUERY PLAN
---------------------------------------------------
Limit
-> Index Scan using int8idx on int8tmp
-> Index Only Scan using int8idx on int8tmp
Order By: (a <-> 464571291354841::bigint)
(3 rows)

View file

@ -77,7 +77,7 @@ SELECT a, a <-> '199 days 21:21:23' FROM intervaltmp ORDER BY a <-> '199 days 21
QUERY PLAN
---------------------------------------------------------------------------
Limit
-> Index Scan using intervalidx on intervaltmp
-> Index Only Scan using intervalidx on intervaltmp
Order By: (a <-> '@ 199 days 21 hours 21 mins 23 secs'::interval)
(3 rows)

View file

@ -64,3 +64,26 @@ SELECT count(*) FROM macaddrtmp WHERE a > '22:00:5c:e5:9b:0d'::macaddr;
540
(1 row)
-- Test index-only scans
SET enable_bitmapscan=off;
EXPLAIN (COSTS OFF)
SELECT * FROM macaddrtmp WHERE a < '02:03:04:05:06:07'::macaddr;
QUERY PLAN
--------------------------------------------------
Index Only Scan using macaddridx on macaddrtmp
Index Cond: (a < '02:03:04:05:06:07'::macaddr)
(2 rows)
SELECT * FROM macaddrtmp WHERE a < '02:03:04:05:06:07'::macaddr;
a
-------------------
01:02:37:05:4f:36
01:02:37:05:4f:36
01:02:37:05:4f:36
01:02:37:05:4f:36
01:43:b5:79:eb:0f
01:43:b5:79:eb:0f
01:43:b5:79:eb:0f
01:43:b5:79:eb:0f
(8 rows)

View file

@ -186,3 +186,22 @@ SELECT count(*) FROM numerictmp WHERE a > 0 ;
576
(1 row)
-- Test index-only scans
SET enable_bitmapscan=off;
EXPLAIN (COSTS OFF)
SELECT * FROM numerictmp WHERE a BETWEEN 1 AND 300 ORDER BY a;
QUERY PLAN
-----------------------------------------------------------------
Sort
Sort Key: a
-> Index Only Scan using numericidx on numerictmp
Index Cond: ((a >= 1::numeric) AND (a <= 300::numeric))
(4 rows)
SELECT * FROM numerictmp WHERE a BETWEEN 1 AND 300 ORDER BY a;
a
------------
204.035430
207.400532
(2 rows)

View file

@ -71,3 +71,19 @@ SELECT count(*) FROM texttmp WHERE a = '2eb2c961c1cbf6 cf8d7b68cb9a2f36 7bbedb
1
(1 row)
-- Test index-only scans
SET enable_bitmapscan=off;
EXPLAIN (COSTS OFF)
SELECT * FROM texttmp WHERE a BETWEEN '31a' AND '31c';
QUERY PLAN
-----------------------------------------------------------
Index Only Scan using textidx on texttmp
Index Cond: ((a >= '31a'::text) AND (a <= '31c'::text))
(2 rows)
SELECT * FROM texttmp WHERE a BETWEEN '31a' AND '31c';
a
------
31b0
(1 row)

View file

@ -71,3 +71,19 @@ SELECT count(*) FROM texttmp WHERE a = '2eb2c961c1cbf6 cf8d7b68cb9a2f36 7bbedb
1
(1 row)
-- Test index-only scans
SET enable_bitmapscan=off;
EXPLAIN (COSTS OFF)
SELECT * FROM texttmp WHERE a BETWEEN '31a' AND '31c';
QUERY PLAN
-----------------------------------------------------------
Index Only Scan using textidx on texttmp
Index Cond: ((a >= '31a'::text) AND (a <= '31c'::text))
(2 rows)
SELECT * FROM texttmp WHERE a BETWEEN '31a' AND '31c';
a
------
31b0
(1 row)

View file

@ -77,7 +77,7 @@ SELECT a, a <-> '10:57:11' FROM timetmp ORDER BY a <-> '10:57:11' LIMIT 3;
QUERY PLAN
--------------------------------------------------------------
Limit
-> Index Scan using timeidx on timetmp
-> Index Only Scan using timeidx on timetmp
Order By: (a <-> '10:57:11'::time without time zone)
(3 rows)

View file

@ -77,7 +77,7 @@ SELECT a, a <-> '2004-10-26 08:55:08' FROM timestamptmp ORDER BY a <-> '2004-10-
QUERY PLAN
-----------------------------------------------------------------------------------
Limit
-> Index Scan using timestampidx on timestamptmp
-> Index Only Scan using timestampidx on timestamptmp
Order By: (a <-> 'Tue Oct 26 08:55:08 2004'::timestamp without time zone)
(3 rows)

View file

@ -197,7 +197,7 @@ SELECT a, a <-> '2018-12-18 10:59:54 GMT+2' FROM timestamptztmp ORDER BY a <-> '
QUERY PLAN
------------------------------------------------------------------------------------
Limit
-> Index Scan using timestamptzidx on timestamptztmp
-> Index Only Scan using timestamptzidx on timestamptztmp
Order By: (a <-> 'Tue Dec 18 04:59:54 2018 PST'::timestamp with time zone)
(3 rows)

View file

@ -64,3 +64,13 @@ SELECT count(*) FROM varbittmp WHERE a > '1110100111010'::varbit;
50
(1 row)
-- Test index-only scans
SET enable_bitmapscan=off;
EXPLAIN (COSTS OFF)
SELECT a FROM bittmp WHERE a BETWEEN '1000000' and '1000001';
QUERY PLAN
-----------------------------------------------------------------------
Index Only Scan using bitidx on bittmp
Index Cond: ((a >= B'1000000'::"bit") AND (a <= B'1000001'::"bit"))
(2 rows)

View file

@ -29,3 +29,8 @@ SELECT count(*) FROM bittmp WHERE a = '011011000100010111011000110000100';
SELECT count(*) FROM bittmp WHERE a >= '011011000100010111011000110000100';
SELECT count(*) FROM bittmp WHERE a > '011011000100010111011000110000100';
-- Test index-only scans
SET enable_bitmapscan=off;
EXPLAIN (COSTS OFF)
SELECT a FROM bittmp WHERE a BETWEEN '1000000' and '1000001';

File diff suppressed because one or more lines are too long

View file

@ -29,3 +29,9 @@ SELECT count(*) FROM chartmp WHERE a = '31b0'::char(32);
SELECT count(*) FROM chartmp WHERE a >= '31b0'::char(32);
SELECT count(*) FROM chartmp WHERE a > '31b0'::char(32);
-- Test index-only scans
SET enable_bitmapscan=off;
EXPLAIN (COSTS OFF)
SELECT * FROM chartmp WHERE a BETWEEN '31a' AND '31c';
SELECT * FROM chartmp WHERE a BETWEEN '31a' AND '31c';

View file

@ -29,3 +29,9 @@ SELECT count(*) FROM macaddrtmp WHERE a = '22:00:5c:e5:9b:0d'::macaddr;
SELECT count(*) FROM macaddrtmp WHERE a >= '22:00:5c:e5:9b:0d'::macaddr;
SELECT count(*) FROM macaddrtmp WHERE a > '22:00:5c:e5:9b:0d'::macaddr;
-- Test index-only scans
SET enable_bitmapscan=off;
EXPLAIN (COSTS OFF)
SELECT * FROM macaddrtmp WHERE a < '02:03:04:05:06:07'::macaddr;
SELECT * FROM macaddrtmp WHERE a < '02:03:04:05:06:07'::macaddr;

View file

@ -75,3 +75,9 @@ SELECT count(*) FROM numerictmp WHERE a = 0 ;
SELECT count(*) FROM numerictmp WHERE a >= 0 ;
SELECT count(*) FROM numerictmp WHERE a > 0 ;
-- Test index-only scans
SET enable_bitmapscan=off;
EXPLAIN (COSTS OFF)
SELECT * FROM numerictmp WHERE a BETWEEN 1 AND 300 ORDER BY a;
SELECT * FROM numerictmp WHERE a BETWEEN 1 AND 300 ORDER BY a;

File diff suppressed because one or more lines are too long

View file

@ -29,3 +29,8 @@ SELECT count(*) FROM varbittmp WHERE a = '1110100111010'::varbit;
SELECT count(*) FROM varbittmp WHERE a >= '1110100111010'::varbit;
SELECT count(*) FROM varbittmp WHERE a > '1110100111010'::varbit;
-- Test index-only scans
SET enable_bitmapscan=off;
EXPLAIN (COSTS OFF)
SELECT a FROM bittmp WHERE a BETWEEN '1000000' and '1000001';