Commit e09b4831 authored by Heikki Linnakangas's avatar Heikki Linnakangas

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.
parent 735cd612
...@@ -9,7 +9,8 @@ OBJS = btree_gist.o btree_utils_num.o btree_utils_var.o btree_int2.o \ ...@@ -9,7 +9,8 @@ OBJS = btree_gist.o btree_utils_num.o btree_utils_var.o btree_int2.o \
btree_numeric.o $(WIN32RES) btree_numeric.o $(WIN32RES)
EXTENSION = btree_gist 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" PGFILEDESC = "btree_gist - B-tree equivalent GIST operator classes"
REGRESS = init int2 int4 int8 float4 float8 cash oid timestamp timestamptz \ REGRESS = init int2 int4 int8 float4 float8 cash oid timestamp timestamptz \
......
...@@ -17,6 +17,7 @@ typedef struct ...@@ -17,6 +17,7 @@ typedef struct
** Cash ops ** Cash ops
*/ */
PG_FUNCTION_INFO_V1(gbt_cash_compress); 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_union);
PG_FUNCTION_INFO_V1(gbt_cash_picksplit); PG_FUNCTION_INFO_V1(gbt_cash_picksplit);
PG_FUNCTION_INFO_V1(gbt_cash_consistent); PG_FUNCTION_INFO_V1(gbt_cash_consistent);
...@@ -123,6 +124,13 @@ gbt_cash_compress(PG_FUNCTION_ARGS) ...@@ -123,6 +124,13 @@ gbt_cash_compress(PG_FUNCTION_ARGS)
PG_RETURN_POINTER(gbt_num_compress(entry, &tinfo)); 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 Datum
gbt_cash_consistent(PG_FUNCTION_ARGS) gbt_cash_consistent(PG_FUNCTION_ARGS)
......
...@@ -17,6 +17,7 @@ typedef struct ...@@ -17,6 +17,7 @@ typedef struct
** date ops ** date ops
*/ */
PG_FUNCTION_INFO_V1(gbt_date_compress); 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_union);
PG_FUNCTION_INFO_V1(gbt_date_picksplit); PG_FUNCTION_INFO_V1(gbt_date_picksplit);
PG_FUNCTION_INFO_V1(gbt_date_consistent); PG_FUNCTION_INFO_V1(gbt_date_consistent);
...@@ -134,7 +135,13 @@ gbt_date_compress(PG_FUNCTION_ARGS) ...@@ -134,7 +135,13 @@ gbt_date_compress(PG_FUNCTION_ARGS)
PG_RETURN_POINTER(gbt_num_compress(entry, &tinfo)); 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 Datum
gbt_date_consistent(PG_FUNCTION_ARGS) gbt_date_consistent(PG_FUNCTION_ARGS)
......
...@@ -16,6 +16,7 @@ typedef struct float4key ...@@ -16,6 +16,7 @@ typedef struct float4key
** float4 ops ** float4 ops
*/ */
PG_FUNCTION_INFO_V1(gbt_float4_compress); 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_union);
PG_FUNCTION_INFO_V1(gbt_float4_picksplit); PG_FUNCTION_INFO_V1(gbt_float4_picksplit);
PG_FUNCTION_INFO_V1(gbt_float4_consistent); PG_FUNCTION_INFO_V1(gbt_float4_consistent);
...@@ -116,6 +117,13 @@ gbt_float4_compress(PG_FUNCTION_ARGS) ...@@ -116,6 +117,13 @@ gbt_float4_compress(PG_FUNCTION_ARGS)
PG_RETURN_POINTER(gbt_num_compress(entry, &tinfo)); 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 Datum
gbt_float4_consistent(PG_FUNCTION_ARGS) gbt_float4_consistent(PG_FUNCTION_ARGS)
......
...@@ -16,6 +16,7 @@ typedef struct float8key ...@@ -16,6 +16,7 @@ typedef struct float8key
** float8 ops ** float8 ops
*/ */
PG_FUNCTION_INFO_V1(gbt_float8_compress); 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_union);
PG_FUNCTION_INFO_V1(gbt_float8_picksplit); PG_FUNCTION_INFO_V1(gbt_float8_picksplit);
PG_FUNCTION_INFO_V1(gbt_float8_consistent); PG_FUNCTION_INFO_V1(gbt_float8_consistent);
...@@ -123,6 +124,13 @@ gbt_float8_compress(PG_FUNCTION_ARGS) ...@@ -123,6 +124,13 @@ gbt_float8_compress(PG_FUNCTION_ARGS)
PG_RETURN_POINTER(gbt_num_compress(entry, &tinfo)); 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 Datum
gbt_float8_consistent(PG_FUNCTION_ARGS) gbt_float8_consistent(PG_FUNCTION_ARGS)
......
/* 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) ;
# btree_gist extension # btree_gist extension
comment = 'support for indexing common datatypes in GiST' comment = 'support for indexing common datatypes in GiST'
default_version = '1.0' default_version = '1.1'
module_pathname = '$libdir/btree_gist' module_pathname = '$libdir/btree_gist'
relocatable = true relocatable = true
...@@ -16,6 +16,7 @@ typedef struct int16key ...@@ -16,6 +16,7 @@ typedef struct int16key
** int16 ops ** int16 ops
*/ */
PG_FUNCTION_INFO_V1(gbt_int2_compress); 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_union);
PG_FUNCTION_INFO_V1(gbt_int2_picksplit); PG_FUNCTION_INFO_V1(gbt_int2_picksplit);
PG_FUNCTION_INFO_V1(gbt_int2_consistent); PG_FUNCTION_INFO_V1(gbt_int2_consistent);
...@@ -123,6 +124,13 @@ gbt_int2_compress(PG_FUNCTION_ARGS) ...@@ -123,6 +124,13 @@ gbt_int2_compress(PG_FUNCTION_ARGS)
PG_RETURN_POINTER(gbt_num_compress(entry, &tinfo)); 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 Datum
gbt_int2_consistent(PG_FUNCTION_ARGS) gbt_int2_consistent(PG_FUNCTION_ARGS)
......
...@@ -16,6 +16,7 @@ typedef struct int32key ...@@ -16,6 +16,7 @@ typedef struct int32key
** int32 ops ** int32 ops
*/ */
PG_FUNCTION_INFO_V1(gbt_int4_compress); 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_union);
PG_FUNCTION_INFO_V1(gbt_int4_picksplit); PG_FUNCTION_INFO_V1(gbt_int4_picksplit);
PG_FUNCTION_INFO_V1(gbt_int4_consistent); PG_FUNCTION_INFO_V1(gbt_int4_consistent);
...@@ -124,6 +125,13 @@ gbt_int4_compress(PG_FUNCTION_ARGS) ...@@ -124,6 +125,13 @@ gbt_int4_compress(PG_FUNCTION_ARGS)
PG_RETURN_POINTER(gbt_num_compress(entry, &tinfo)); 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 Datum
gbt_int4_consistent(PG_FUNCTION_ARGS) gbt_int4_consistent(PG_FUNCTION_ARGS)
......
...@@ -16,6 +16,7 @@ typedef struct int64key ...@@ -16,6 +16,7 @@ typedef struct int64key
** int64 ops ** int64 ops
*/ */
PG_FUNCTION_INFO_V1(gbt_int8_compress); 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_union);
PG_FUNCTION_INFO_V1(gbt_int8_picksplit); PG_FUNCTION_INFO_V1(gbt_int8_picksplit);
PG_FUNCTION_INFO_V1(gbt_int8_consistent); PG_FUNCTION_INFO_V1(gbt_int8_consistent);
...@@ -124,6 +125,13 @@ gbt_int8_compress(PG_FUNCTION_ARGS) ...@@ -124,6 +125,13 @@ gbt_int8_compress(PG_FUNCTION_ARGS)
PG_RETURN_POINTER(gbt_num_compress(entry, &tinfo)); 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 Datum
gbt_int8_consistent(PG_FUNCTION_ARGS) gbt_int8_consistent(PG_FUNCTION_ARGS)
......
...@@ -18,6 +18,7 @@ typedef struct ...@@ -18,6 +18,7 @@ typedef struct
** Interval ops ** Interval ops
*/ */
PG_FUNCTION_INFO_V1(gbt_intv_compress); 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_decompress);
PG_FUNCTION_INFO_V1(gbt_intv_union); PG_FUNCTION_INFO_V1(gbt_intv_union);
PG_FUNCTION_INFO_V1(gbt_intv_picksplit); PG_FUNCTION_INFO_V1(gbt_intv_picksplit);
...@@ -174,6 +175,14 @@ gbt_intv_compress(PG_FUNCTION_ARGS) ...@@ -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 Datum
gbt_intv_decompress(PG_FUNCTION_ARGS) gbt_intv_decompress(PG_FUNCTION_ARGS)
{ {
......
...@@ -19,6 +19,7 @@ typedef struct ...@@ -19,6 +19,7 @@ typedef struct
** OID ops ** OID ops
*/ */
PG_FUNCTION_INFO_V1(gbt_macad_compress); 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_union);
PG_FUNCTION_INFO_V1(gbt_macad_picksplit); PG_FUNCTION_INFO_V1(gbt_macad_picksplit);
PG_FUNCTION_INFO_V1(gbt_macad_consistent); PG_FUNCTION_INFO_V1(gbt_macad_consistent);
...@@ -114,6 +115,13 @@ gbt_macad_compress(PG_FUNCTION_ARGS) ...@@ -114,6 +115,13 @@ gbt_macad_compress(PG_FUNCTION_ARGS)
PG_RETURN_POINTER(gbt_num_compress(entry, &tinfo)); 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 Datum
gbt_macad_consistent(PG_FUNCTION_ARGS) gbt_macad_consistent(PG_FUNCTION_ARGS)
......
...@@ -16,6 +16,7 @@ typedef struct ...@@ -16,6 +16,7 @@ typedef struct
** OID ops ** OID ops
*/ */
PG_FUNCTION_INFO_V1(gbt_oid_compress); 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_union);
PG_FUNCTION_INFO_V1(gbt_oid_picksplit); PG_FUNCTION_INFO_V1(gbt_oid_picksplit);
PG_FUNCTION_INFO_V1(gbt_oid_consistent); PG_FUNCTION_INFO_V1(gbt_oid_consistent);
...@@ -124,6 +125,13 @@ gbt_oid_compress(PG_FUNCTION_ARGS) ...@@ -124,6 +125,13 @@ gbt_oid_compress(PG_FUNCTION_ARGS)
PG_RETURN_POINTER(gbt_num_compress(entry, &tinfo)); 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 Datum
gbt_oid_consistent(PG_FUNCTION_ARGS) gbt_oid_consistent(PG_FUNCTION_ARGS)
......
...@@ -19,6 +19,7 @@ typedef struct ...@@ -19,6 +19,7 @@ typedef struct
*/ */
PG_FUNCTION_INFO_V1(gbt_time_compress); PG_FUNCTION_INFO_V1(gbt_time_compress);
PG_FUNCTION_INFO_V1(gbt_timetz_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_union);
PG_FUNCTION_INFO_V1(gbt_time_picksplit); PG_FUNCTION_INFO_V1(gbt_time_picksplit);
PG_FUNCTION_INFO_V1(gbt_time_consistent); PG_FUNCTION_INFO_V1(gbt_time_consistent);
...@@ -192,6 +193,13 @@ gbt_timetz_compress(PG_FUNCTION_ARGS) ...@@ -192,6 +193,13 @@ gbt_timetz_compress(PG_FUNCTION_ARGS)
PG_RETURN_POINTER(retval); 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 Datum
gbt_time_consistent(PG_FUNCTION_ARGS) gbt_time_consistent(PG_FUNCTION_ARGS)
......
...@@ -19,6 +19,7 @@ typedef struct ...@@ -19,6 +19,7 @@ typedef struct
*/ */
PG_FUNCTION_INFO_V1(gbt_ts_compress); PG_FUNCTION_INFO_V1(gbt_ts_compress);
PG_FUNCTION_INFO_V1(gbt_tstz_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_union);
PG_FUNCTION_INFO_V1(gbt_ts_picksplit); PG_FUNCTION_INFO_V1(gbt_ts_picksplit);
PG_FUNCTION_INFO_V1(gbt_ts_consistent); PG_FUNCTION_INFO_V1(gbt_ts_consistent);
...@@ -243,6 +244,13 @@ gbt_tstz_compress(PG_FUNCTION_ARGS) ...@@ -243,6 +244,13 @@ gbt_tstz_compress(PG_FUNCTION_ARGS)
PG_RETURN_POINTER(retval); 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 Datum
gbt_ts_consistent(PG_FUNCTION_ARGS) gbt_ts_consistent(PG_FUNCTION_ARGS)
......
...@@ -93,6 +93,64 @@ gbt_num_compress(GISTENTRY *entry, const gbtree_ninfo *tinfo) ...@@ -93,6 +93,64 @@ gbt_num_compress(GISTENTRY *entry, const gbtree_ninfo *tinfo)
return retval; 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;
}
......
...@@ -130,6 +130,7 @@ extern GIST_SPLITVEC *gbt_num_picksplit(const GistEntryVector *entryvec, GIST_SP ...@@ -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_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, extern void *gbt_num_union(GBT_NUMKEY *out, const GistEntryVector *entryvec,
const gbtree_ninfo *tinfo); const gbtree_ninfo *tinfo);
......
...@@ -29,6 +29,7 @@ typedef struct ...@@ -29,6 +29,7 @@ typedef struct
PG_FUNCTION_INFO_V1(gbt_var_decompress); PG_FUNCTION_INFO_V1(gbt_var_decompress);
PG_FUNCTION_INFO_V1(gbt_var_fetch);
Datum Datum
...@@ -301,6 +302,23 @@ gbt_var_compress(GISTENTRY *entry, const gbtree_vinfo *tinfo) ...@@ -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_VARKEY *
gbt_var_union(const GistEntryVector *entryvec, int32 *size, Oid collation, gbt_var_union(const GistEntryVector *entryvec, int32 *size, Oid collation,
const gbtree_vinfo *tinfo) const gbtree_vinfo *tinfo)
......
...@@ -64,3 +64,13 @@ SELECT count(*) FROM bittmp WHERE a > '011011000100010111011000110000100'; ...@@ -64,3 +64,13 @@ SELECT count(*) FROM bittmp WHERE a > '011011000100010111011000110000100';
350 350
(1 row) (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)
...@@ -71,3 +71,20 @@ SELECT count(*) FROM byteatmp WHERE a = '2eb2c961c1cbf6 cf8d7b68cb9a2f36 7bbed ...@@ -71,3 +71,20 @@ SELECT count(*) FROM byteatmp WHERE a = '2eb2c961c1cbf6 cf8d7b68cb9a2f36 7bbed
1 1
(1 row) (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)
...@@ -74,10 +74,10 @@ SELECT count(*) FROM moneytmp WHERE a > '22649.64'::money; ...@@ -74,10 +74,10 @@ SELECT count(*) FROM moneytmp WHERE a > '22649.64'::money;
EXPLAIN (COSTS OFF) EXPLAIN (COSTS OFF)
SELECT a, a <-> '21472.79' FROM moneytmp ORDER BY a <-> '21472.79' LIMIT 3; SELECT a, a <-> '21472.79' FROM moneytmp ORDER BY a <-> '21472.79' LIMIT 3;
QUERY PLAN QUERY PLAN
----------------------------------------------- --------------------------------------------------
Limit Limit
-> Index Scan using moneyidx on moneytmp -> Index Only Scan using moneyidx on moneytmp
Order By: (a <-> '$21,472.79'::money) Order By: (a <-> '$21,472.79'::money)
(3 rows) (3 rows)
......
...@@ -64,3 +64,19 @@ SELECT count(*) FROM chartmp WHERE a > '31b0'::char(32); ...@@ -64,3 +64,19 @@ SELECT count(*) FROM chartmp WHERE a > '31b0'::char(32);
400 400
(1 row) (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)
...@@ -64,3 +64,19 @@ SELECT count(*) FROM chartmp WHERE a > '31b0'::char(32); ...@@ -64,3 +64,19 @@ SELECT count(*) FROM chartmp WHERE a > '31b0'::char(32);
214 214
(1 row) (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)
...@@ -74,10 +74,10 @@ SELECT count(*) FROM datetmp WHERE a > '2001-02-13'::date; ...@@ -74,10 +74,10 @@ SELECT count(*) FROM datetmp WHERE a > '2001-02-13'::date;
EXPLAIN (COSTS OFF) EXPLAIN (COSTS OFF)
SELECT a, a <-> '2001-02-13' FROM datetmp ORDER BY a <-> '2001-02-13' LIMIT 3; SELECT a, a <-> '2001-02-13' FROM datetmp ORDER BY a <-> '2001-02-13' LIMIT 3;
QUERY PLAN QUERY PLAN
---------------------------------------------- ------------------------------------------------
Limit Limit
-> Index Scan using dateidx on datetmp -> Index Only Scan using dateidx on datetmp
Order By: (a <-> '02-13-2001'::date) Order By: (a <-> '02-13-2001'::date)
(3 rows) (3 rows)
......
...@@ -74,10 +74,10 @@ SELECT count(*) FROM float4tmp WHERE a > -179.0::float4; ...@@ -74,10 +74,10 @@ SELECT count(*) FROM float4tmp WHERE a > -179.0::float4;
EXPLAIN (COSTS OFF) EXPLAIN (COSTS OFF)
SELECT a, a <-> '-179.0' FROM float4tmp ORDER BY a <-> '-179.0' LIMIT 3; SELECT a, a <-> '-179.0' FROM float4tmp ORDER BY a <-> '-179.0' LIMIT 3;
QUERY PLAN QUERY PLAN
----------------------------------------------- ----------------------------------------------------
Limit Limit
-> Index Scan using float4idx on float4tmp -> Index Only Scan using float4idx on float4tmp
Order By: (a <-> (-179)::real) Order By: (a <-> (-179)::real)
(3 rows) (3 rows)
......
...@@ -77,7 +77,7 @@ SELECT a, a <-> '-1890.0' FROM float8tmp ORDER BY a <-> '-1890.0' LIMIT 3; ...@@ -77,7 +77,7 @@ SELECT a, a <-> '-1890.0' FROM float8tmp ORDER BY a <-> '-1890.0' LIMIT 3;
QUERY PLAN QUERY PLAN
----------------------------------------------------- -----------------------------------------------------
Limit Limit
-> Index Scan using float8idx on float8tmp -> Index Only Scan using float8idx on float8tmp
Order By: (a <-> (-1890)::double precision) Order By: (a <-> (-1890)::double precision)
(3 rows) (3 rows)
......
...@@ -74,10 +74,10 @@ SELECT count(*) FROM int2tmp WHERE a > 237::int2; ...@@ -74,10 +74,10 @@ SELECT count(*) FROM int2tmp WHERE a > 237::int2;
EXPLAIN (COSTS OFF) EXPLAIN (COSTS OFF)
SELECT a, a <-> '237' FROM int2tmp ORDER BY a <-> '237' LIMIT 3; SELECT a, a <-> '237' FROM int2tmp ORDER BY a <-> '237' LIMIT 3;
QUERY PLAN QUERY PLAN
------------------------------------------- ------------------------------------------------
Limit Limit
-> Index Scan using int2idx on int2tmp -> Index Only Scan using int2idx on int2tmp
Order By: (a <-> 237::smallint) Order By: (a <-> 237::smallint)
(3 rows) (3 rows)
......
...@@ -74,10 +74,10 @@ SELECT count(*) FROM int4tmp WHERE a > 237::int4; ...@@ -74,10 +74,10 @@ SELECT count(*) FROM int4tmp WHERE a > 237::int4;
EXPLAIN (COSTS OFF) EXPLAIN (COSTS OFF)
SELECT a, a <-> '237' FROM int4tmp ORDER BY a <-> '237' LIMIT 3; SELECT a, a <-> '237' FROM int4tmp ORDER BY a <-> '237' LIMIT 3;
QUERY PLAN QUERY PLAN
------------------------------------------- ------------------------------------------------
Limit Limit
-> Index Scan using int4idx on int4tmp -> Index Only Scan using int4idx on int4tmp
Order By: (a <-> 237) Order By: (a <-> 237)
(3 rows) (3 rows)
......
...@@ -77,7 +77,7 @@ SELECT a, a <-> '464571291354841' FROM int8tmp ORDER BY a <-> '464571291354841' ...@@ -77,7 +77,7 @@ SELECT a, a <-> '464571291354841' FROM int8tmp ORDER BY a <-> '464571291354841'
QUERY PLAN QUERY PLAN
--------------------------------------------------- ---------------------------------------------------
Limit Limit
-> Index Scan using int8idx on int8tmp -> Index Only Scan using int8idx on int8tmp
Order By: (a <-> 464571291354841::bigint) Order By: (a <-> 464571291354841::bigint)
(3 rows) (3 rows)
......
...@@ -77,7 +77,7 @@ SELECT a, a <-> '199 days 21:21:23' FROM intervaltmp ORDER BY a <-> '199 days 21 ...@@ -77,7 +77,7 @@ SELECT a, a <-> '199 days 21:21:23' FROM intervaltmp ORDER BY a <-> '199 days 21
QUERY PLAN QUERY PLAN
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
Limit 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) Order By: (a <-> '@ 199 days 21 hours 21 mins 23 secs'::interval)
(3 rows) (3 rows)
......
...@@ -64,3 +64,26 @@ SELECT count(*) FROM macaddrtmp WHERE a > '22:00:5c:e5:9b:0d'::macaddr; ...@@ -64,3 +64,26 @@ SELECT count(*) FROM macaddrtmp WHERE a > '22:00:5c:e5:9b:0d'::macaddr;
540 540
(1 row) (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)
...@@ -186,3 +186,22 @@ SELECT count(*) FROM numerictmp WHERE a > 0 ; ...@@ -186,3 +186,22 @@ SELECT count(*) FROM numerictmp WHERE a > 0 ;
576 576
(1 row) (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)
...@@ -71,3 +71,19 @@ SELECT count(*) FROM texttmp WHERE a = '2eb2c961c1cbf6 cf8d7b68cb9a2f36 7bbedb ...@@ -71,3 +71,19 @@ SELECT count(*) FROM texttmp WHERE a = '2eb2c961c1cbf6 cf8d7b68cb9a2f36 7bbedb
1 1
(1 row) (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)
...@@ -71,3 +71,19 @@ SELECT count(*) FROM texttmp WHERE a = '2eb2c961c1cbf6 cf8d7b68cb9a2f36 7bbedb ...@@ -71,3 +71,19 @@ SELECT count(*) FROM texttmp WHERE a = '2eb2c961c1cbf6 cf8d7b68cb9a2f36 7bbedb
1 1
(1 row) (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)
...@@ -77,7 +77,7 @@ SELECT a, a <-> '10:57:11' FROM timetmp ORDER BY a <-> '10:57:11' LIMIT 3; ...@@ -77,7 +77,7 @@ SELECT a, a <-> '10:57:11' FROM timetmp ORDER BY a <-> '10:57:11' LIMIT 3;
QUERY PLAN QUERY PLAN
-------------------------------------------------------------- --------------------------------------------------------------
Limit Limit
-> Index Scan using timeidx on timetmp -> Index Only Scan using timeidx on timetmp
Order By: (a <-> '10:57:11'::time without time zone) Order By: (a <-> '10:57:11'::time without time zone)
(3 rows) (3 rows)
......
...@@ -77,7 +77,7 @@ SELECT a, a <-> '2004-10-26 08:55:08' FROM timestamptmp ORDER BY a <-> '2004-10- ...@@ -77,7 +77,7 @@ SELECT a, a <-> '2004-10-26 08:55:08' FROM timestamptmp ORDER BY a <-> '2004-10-
QUERY PLAN QUERY PLAN
----------------------------------------------------------------------------------- -----------------------------------------------------------------------------------
Limit 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) Order By: (a <-> 'Tue Oct 26 08:55:08 2004'::timestamp without time zone)
(3 rows) (3 rows)
......
...@@ -197,7 +197,7 @@ SELECT a, a <-> '2018-12-18 10:59:54 GMT+2' FROM timestamptztmp ORDER BY a <-> ' ...@@ -197,7 +197,7 @@ SELECT a, a <-> '2018-12-18 10:59:54 GMT+2' FROM timestamptztmp ORDER BY a <-> '
QUERY PLAN QUERY PLAN
------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------
Limit 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) Order By: (a <-> 'Tue Dec 18 04:59:54 2018 PST'::timestamp with time zone)
(3 rows) (3 rows)
......
...@@ -64,3 +64,13 @@ SELECT count(*) FROM varbittmp WHERE a > '1110100111010'::varbit; ...@@ -64,3 +64,13 @@ SELECT count(*) FROM varbittmp WHERE a > '1110100111010'::varbit;
50 50
(1 row) (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)
...@@ -29,3 +29,8 @@ SELECT count(*) FROM bittmp WHERE a = '011011000100010111011000110000100'; ...@@ -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';
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';
This diff is collapsed.
...@@ -29,3 +29,9 @@ SELECT count(*) FROM chartmp WHERE a = '31b0'::char(32); ...@@ -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);
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';
...@@ -29,3 +29,9 @@ SELECT count(*) FROM macaddrtmp WHERE a = '22:00:5c:e5:9b:0d'::macaddr; ...@@ -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;
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;
...@@ -75,3 +75,9 @@ SELECT count(*) FROM numerictmp WHERE a = 0 ; ...@@ -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 ;
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;
This diff is collapsed.
...@@ -29,3 +29,8 @@ SELECT count(*) FROM varbittmp WHERE a = '1110100111010'::varbit; ...@@ -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;
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';
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment