diff options
author | Heikki Linnakangas <heikki.linnakangas@iki.fi> | 2015-03-27 23:35:16 +0200 |
---|---|---|
committer | Heikki Linnakangas <heikki.linnakangas@iki.fi> | 2015-03-27 23:35:16 +0200 |
commit | e09b48316c22fce727bce3c89fa64fc627787e6a (patch) | |
tree | 107a22f368efd340c6f545f0e6b7130b5063aa08 /contrib/btree_gist/expected | |
parent | 735cd6128a6a401671126443a9af4324932a38d6 (diff) | |
download | postgresql-e09b48316c22fce727bce3c89fa64fc627787e6a.tar.gz postgresql-e09b48316c22fce727bce3c89fa64fc627787e6a.zip |
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.
Diffstat (limited to 'contrib/btree_gist/expected')
20 files changed, 164 insertions, 21 deletions
diff --git a/contrib/btree_gist/expected/bit.out b/contrib/btree_gist/expected/bit.out index ae823046002..8606baf366e 100644 --- a/contrib/btree_gist/expected/bit.out +++ b/contrib/btree_gist/expected/bit.out @@ -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) + diff --git a/contrib/btree_gist/expected/bytea.out b/contrib/btree_gist/expected/bytea.out index 917fac18125..b9efa73c085 100644 --- a/contrib/btree_gist/expected/bytea.out +++ b/contrib/btree_gist/expected/bytea.out @@ -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) + diff --git a/contrib/btree_gist/expected/cash.out b/contrib/btree_gist/expected/cash.out index a4100d844e7..cacbd718541 100644 --- a/contrib/btree_gist/expected/cash.out +++ b/contrib/btree_gist/expected/cash.out @@ -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) diff --git a/contrib/btree_gist/expected/char.out b/contrib/btree_gist/expected/char.out index 5260995a755..d715c045cc1 100644 --- a/contrib/btree_gist/expected/char.out +++ b/contrib/btree_gist/expected/char.out @@ -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) + diff --git a/contrib/btree_gist/expected/char_1.out b/contrib/btree_gist/expected/char_1.out index a1d24876d8a..867318002b8 100644 --- a/contrib/btree_gist/expected/char_1.out +++ b/contrib/btree_gist/expected/char_1.out @@ -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) + diff --git a/contrib/btree_gist/expected/date.out b/contrib/btree_gist/expected/date.out index 4a360bea6d6..5db864bb82c 100644 --- a/contrib/btree_gist/expected/date.out +++ b/contrib/btree_gist/expected/date.out @@ -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) diff --git a/contrib/btree_gist/expected/float4.out b/contrib/btree_gist/expected/float4.out index 1695f7805a0..4a52a9399a5 100644 --- a/contrib/btree_gist/expected/float4.out +++ b/contrib/btree_gist/expected/float4.out @@ -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) diff --git a/contrib/btree_gist/expected/float8.out b/contrib/btree_gist/expected/float8.out index 7d2228b7973..918d84860f5 100644 --- a/contrib/btree_gist/expected/float8.out +++ b/contrib/btree_gist/expected/float8.out @@ -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) diff --git a/contrib/btree_gist/expected/int2.out b/contrib/btree_gist/expected/int2.out index b1cc3b14b25..711e2c722ac 100644 --- a/contrib/btree_gist/expected/int2.out +++ b/contrib/btree_gist/expected/int2.out @@ -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) diff --git a/contrib/btree_gist/expected/int4.out b/contrib/btree_gist/expected/int4.out index 41bed1f6e34..6bbdc7c3f4b 100644 --- a/contrib/btree_gist/expected/int4.out +++ b/contrib/btree_gist/expected/int4.out @@ -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) diff --git a/contrib/btree_gist/expected/int8.out b/contrib/btree_gist/expected/int8.out index ff0af4a5fb8..55982ee3b5c 100644 --- a/contrib/btree_gist/expected/int8.out +++ b/contrib/btree_gist/expected/int8.out @@ -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) diff --git a/contrib/btree_gist/expected/interval.out b/contrib/btree_gist/expected/interval.out index 6955251a045..875380978e9 100644 --- a/contrib/btree_gist/expected/interval.out +++ b/contrib/btree_gist/expected/interval.out @@ -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) diff --git a/contrib/btree_gist/expected/macaddr.out b/contrib/btree_gist/expected/macaddr.out index 3f0271bd253..c0a4c6287f3 100644 --- a/contrib/btree_gist/expected/macaddr.out +++ b/contrib/btree_gist/expected/macaddr.out @@ -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) + diff --git a/contrib/btree_gist/expected/numeric.out b/contrib/btree_gist/expected/numeric.out index 1ab7ae6486b..b9b67b503a2 100644 --- a/contrib/btree_gist/expected/numeric.out +++ b/contrib/btree_gist/expected/numeric.out @@ -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) + diff --git a/contrib/btree_gist/expected/text.out b/contrib/btree_gist/expected/text.out index 4905cb023bb..bb4e2e62d1d 100644 --- a/contrib/btree_gist/expected/text.out +++ b/contrib/btree_gist/expected/text.out @@ -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) + diff --git a/contrib/btree_gist/expected/text_1.out b/contrib/btree_gist/expected/text_1.out index e2b9c1b6b7d..8ef1ffb2d13 100644 --- a/contrib/btree_gist/expected/text_1.out +++ b/contrib/btree_gist/expected/text_1.out @@ -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) + diff --git a/contrib/btree_gist/expected/time.out b/contrib/btree_gist/expected/time.out index 1b9da4e192a..ec95ef77c57 100644 --- a/contrib/btree_gist/expected/time.out +++ b/contrib/btree_gist/expected/time.out @@ -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) diff --git a/contrib/btree_gist/expected/timestamp.out b/contrib/btree_gist/expected/timestamp.out index cc3624f0843..0d94f2f245c 100644 --- a/contrib/btree_gist/expected/timestamp.out +++ b/contrib/btree_gist/expected/timestamp.out @@ -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) diff --git a/contrib/btree_gist/expected/timestamptz.out b/contrib/btree_gist/expected/timestamptz.out index 88d2404c44b..75a15a42568 100644 --- a/contrib/btree_gist/expected/timestamptz.out +++ b/contrib/btree_gist/expected/timestamptz.out @@ -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) diff --git a/contrib/btree_gist/expected/varbit.out b/contrib/btree_gist/expected/varbit.out index e6765f4231f..538ace85c90 100644 --- a/contrib/btree_gist/expected/varbit.out +++ b/contrib/btree_gist/expected/varbit.out @@ -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) + |