From 494d3b1ccc0fd3868924e7fd73cc8061e1150294 Mon Sep 17 00:00:00 2001 From: Zongtian Hou Date: Thu, 3 Nov 2022 17:56:09 +0800 Subject: [PATCH] fix indexonlyscan disabled when disable indexscan --- src/gausskernel/optimizer/path/costsize.cpp | 8 +- .../expected/bypass_simplequery_support.out | 82 +++++++------- .../col_partition_iterator_elimination.out | 36 +++---- .../regress/expected/force_vector_engine.out | 12 +-- src/test/regress/expected/hash_index_001.out | 8 ++ .../regress/expected/sqlbypass_partition.out | 100 +++++++++--------- src/test/regress/expected/vec_bitmap_1.out | 9 +- src/test/regress/sql/hash_index_001.sql | 1 + 8 files changed, 130 insertions(+), 126 deletions(-) mode change 100755 => 100644 src/test/regress/expected/bypass_simplequery_support.out diff --git a/src/gausskernel/optimizer/path/costsize.cpp b/src/gausskernel/optimizer/path/costsize.cpp index 56100f7f763..591e6522329 100755 --- a/src/gausskernel/optimizer/path/costsize.cpp +++ b/src/gausskernel/optimizer/path/costsize.cpp @@ -982,8 +982,12 @@ void cost_index(IndexPath* path, PlannerInfo* root, double loop_count) double tuples_fetched; double pages_fetched; bool ispartitionedindex = path->indexinfo->rel->isPartitionedTable; - bool disable_path = enable_parametrized_path(root, baserel, (Path*)path) || \ - (!u_sess->attr.attr_sql.enable_indexscan); + bool disable_path = false; + if (enable_parametrized_path(root, baserel, (Path*)path) || + (!u_sess->attr.attr_sql.enable_indexscan && !indexonly) || + (!u_sess->attr.attr_sql.enable_indexonlyscan && indexonly)) { + disable_path = true; + } /* Should only be applied to base relations */ AssertEreport(IsA(baserel, RelOptInfo) && IsA(index, IndexOptInfo), diff --git a/src/test/regress/expected/bypass_simplequery_support.out b/src/test/regress/expected/bypass_simplequery_support.out old mode 100755 new mode 100644 index 7527bc40191..26ff51c3c47 --- a/src/test/regress/expected/bypass_simplequery_support.out +++ b/src/test/regress/expected/bypass_simplequery_support.out @@ -224,10 +224,10 @@ reset enable_indexonlyscan; --bypass though index only scan set enable_indexscan = off; explain select col1,col2 from test_bypass_sq1 where col1=0 and col2=0; - QUERY PLAN -------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +--------------------------------------------------------------------------------------------- [Bypass] - Index Only Scan using itest_bypass_sq1 on test_bypass_sq1 (cost=10000000000.00..1000000000827.01 rows=1 width=8) + Index Only Scan using itest_bypass_sq1 on test_bypass_sq1 (cost=0.00..8.27 rows=1 width=8) Index Cond: ((col1 = 0) AND (col2 = 0)) (3 rows) @@ -240,11 +240,11 @@ select col1,col2 from test_bypass_sq1 where col1=0 and col2=0; (3 rows) explain select col1,col2 from test_bypass_sq1 where col1=0 and col2=0 order by col1 limit 1; - QUERY PLAN -------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +--------------------------------------------------------------------------------------------------- [Bypass] - Limit (cost=10000000000.00..1000000000827.01 rows=1 width=8) - -> Index Only Scan using itest_bypass_sq1 on test_bypass_sq1 (cost=10000000000.00..1000000000827.01 rows=1 width=8) + Limit (cost=0.00..8.27 rows=1 width=8) + -> Index Only Scan using itest_bypass_sq1 on test_bypass_sq1 (cost=0.00..8.27 rows=1 width=8) Index Cond: ((col1 = 0) AND (col2 = 0)) (4 rows) @@ -255,11 +255,11 @@ select col1,col2 from test_bypass_sq1 where col1=0 and col2=0 order by col1 limi (1 row) explain select col1,col2 from test_bypass_sq1 where col1=0 and col2=0 order by col1 limit 0; - QUERY PLAN -------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +--------------------------------------------------------------------------------------------------- [Bypass] - Limit (cost=10000000000.00..1000000000827.01 rows=1 width=8) - -> Index Only Scan using itest_bypass_sq1 on test_bypass_sq1 (cost=10000000000.00..1000000000827.01 rows=1 width=8) + Limit (cost=0.00..8.27 rows=1 width=8) + -> Index Only Scan using itest_bypass_sq1 on test_bypass_sq1 (cost=0.00..8.27 rows=1 width=8) Index Cond: ((col1 = 0) AND (col2 = 0)) (4 rows) @@ -606,10 +606,10 @@ select * from test_bypass_sq1 where col1=1 and col2=2 order by col1 for update l --bypass though index only scan set enable_indexscan = off; explain select col1,col2 from test_bypass_sq1 where col1=0 order by col2; - QUERY PLAN -------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +---------------------------------------------------------------------------------------------- [Bypass] - Index Only Scan using itest_bypass_sq1 on test_bypass_sq1 (cost=10000000000.00..1000000002435.51 rows=6 width=8) + Index Only Scan using itest_bypass_sq1 on test_bypass_sq1 (cost=0.00..24.36 rows=6 width=8) Index Cond: (col1 = 0) (3 rows) @@ -623,10 +623,10 @@ select col1,col2 from test_bypass_sq1 where col1=0 order by col2; (4 rows) explain select col2,col1 from test_bypass_sq1 where col2=2 order by col1; - QUERY PLAN -------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +---------------------------------------------------------------------------------------------- [Bypass] - Index Only Scan using itest_bypass_sq1 on test_bypass_sq1 (cost=10000000000.00..1000000003706.26 rows=6 width=8) + Index Only Scan using itest_bypass_sq1 on test_bypass_sq1 (cost=0.00..37.06 rows=6 width=8) Index Cond: (col2 = 2) (3 rows) @@ -639,10 +639,10 @@ select col2,col1 from test_bypass_sq1 where col2=2 order by col1; (3 rows) explain select col1,col2 from test_bypass_sq1 where col1>0 order by col1; - QUERY PLAN ---------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +------------------------------------------------------------------------------------------------ [Bypass] - Index Only Scan using itest_bypass_sq1 on test_bypass_sq1 (cost=10000000000.00..1000000005105.76 rows=389 width=8) + Index Only Scan using itest_bypass_sq1 on test_bypass_sq1 (cost=0.00..51.06 rows=389 width=8) Index Cond: (col1 > 0) (3 rows) @@ -659,10 +659,10 @@ select col1,col2 from test_bypass_sq1 where col1>0 order by col1; (7 rows) explain select col1,col2 from test_bypass_sq1 where col1 is null and col2 is null; - QUERY PLAN -------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +--------------------------------------------------------------------------------------------- [Bypass] - Index Only Scan using itest_bypass_sq1 on test_bypass_sq1 (cost=10000000000.00..1000000000827.01 rows=1 width=8) + Index Only Scan using itest_bypass_sq1 on test_bypass_sq1 (cost=0.00..8.27 rows=1 width=8) Index Cond: ((col1 IS NULL) AND (col2 IS NULL)) (3 rows) @@ -673,11 +673,11 @@ select col1,col2 from test_bypass_sq1 where col1 is null and col2 is null; (1 row) explain select col2,col1 from test_bypass_sq1 where col1>0 order by col1 limit 3; - QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +------------------------------------------------------------------------------------------------------ [Bypass] - Limit (cost=10000000000.00..17634961478.96 rows=3 width=8) - -> Index Only Scan using itest_bypass_sq1 on test_bypass_sq1 (cost=10000000000.00..1000000005105.76 rows=389 width=8) + Limit (cost=0.00..0.39 rows=3 width=8) + -> Index Only Scan using itest_bypass_sq1 on test_bypass_sq1 (cost=0.00..51.06 rows=389 width=8) Index Cond: (col1 > 0) (4 rows) @@ -690,10 +690,10 @@ select col2,col1 from test_bypass_sq1 where col1>0 order by col1 limit 3; (3 rows) explain select col1,col2 from test_bypass_sq1 where col2<5 order by col1; - QUERY PLAN ---------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +------------------------------------------------------------------------------------------------ [Bypass] - Index Only Scan using itest_bypass_sq1 on test_bypass_sq1 (cost=10000000000.00..1000000006089.26 rows=389 width=8) + Index Only Scan using itest_bypass_sq1 on test_bypass_sq1 (cost=0.00..60.89 rows=389 width=8) Index Cond: (col2 < 5) (3 rows) @@ -710,10 +710,10 @@ select col1,col2 from test_bypass_sq1 where col2<5 order by col1; (7 rows) explain select col1,col2 from test_bypass_sq1 where col1>=0 and col2>0 order by col1; - QUERY PLAN ---------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +------------------------------------------------------------------------------------------------ [Bypass] - Index Only Scan using itest_bypass_sq1 on test_bypass_sq1 (cost=10000000000.00..1000000004944.01 rows=130 width=8) + Index Only Scan using itest_bypass_sq1 on test_bypass_sq1 (cost=0.00..49.44 rows=130 width=8) Index Cond: ((col1 >= 0) AND (col2 > 0)) (3 rows) @@ -734,11 +734,11 @@ select col1,col2 from test_bypass_sq1 where col1>=0 and col2>0 order by col1; (11 rows) explain select col1,col2 from test_bypass_sq1 where col1>=0 and col2>0 order by col1 limit 3; - QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +------------------------------------------------------------------------------------------------------ [Bypass] - Limit (cost=10000000000.00..32846153960.25 rows=3 width=8) - -> Index Only Scan using itest_bypass_sq1 on test_bypass_sq1 (cost=10000000000.00..1000000004944.01 rows=130 width=8) + Limit (cost=0.00..1.14 rows=3 width=8) + -> Index Only Scan using itest_bypass_sq1 on test_bypass_sq1 (cost=0.00..49.44 rows=130 width=8) Index Cond: ((col1 >= 0) AND (col2 > 0)) (4 rows) @@ -751,11 +751,11 @@ select col1,col2 from test_bypass_sq1 where col1>=0 and col2>0 order by col1 lim (3 rows) explain select col1,col2 from test_bypass_sq1 where col1>=0 and col2>0 order by col1 limit null; - QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +------------------------------------------------------------------------------------------------------ [Bypass] - Limit (cost=10000000000.00..1000000004944.01 rows=130 width=8) - -> Index Only Scan using itest_bypass_sq1 on test_bypass_sq1 (cost=10000000000.00..1000000004944.01 rows=130 width=8) + Limit (cost=0.00..49.44 rows=130 width=8) + -> Index Only Scan using itest_bypass_sq1 on test_bypass_sq1 (cost=0.00..49.44 rows=130 width=8) Index Cond: ((col1 >= 0) AND (col2 > 0)) (4 rows) diff --git a/src/test/regress/expected/col_partition_iterator_elimination.out b/src/test/regress/expected/col_partition_iterator_elimination.out index 05e9b20d1d3..211e86b3916 100644 --- a/src/test/regress/expected/col_partition_iterator_elimination.out +++ b/src/test/regress/expected/col_partition_iterator_elimination.out @@ -1215,19 +1215,17 @@ explain(costs off, verbose on) select * from test_range_pt where a = 30 order by (11 rows) explain(costs off, verbose on) select count(a) from test_range_pt where a = 30; - QUERY PLAN ----------------------------------------------------------------------------------------------------- + QUERY PLAN +-------------------------------------------------------------------------------------------------------------------------- Row Adapter Output: (count(a)) -> Vector Aggregate Output: count(a) - -> Partitioned CStore Index Heap Scan on col_partition_iterator_elimination.test_range_pt + -> Partitioned CStore Index Only Scan using idx_range_local on col_partition_iterator_elimination.test_range_pt Output: a - Recheck Cond: (test_range_pt.a = 30) + Index Cond: (test_range_pt.a = 30) Selected Partitions: 3 - -> Partitioned CStore Index Ctid Scan on idx_range_local - Index Cond: (test_range_pt.a = 30) -(10 rows) +(8 rows) explain(costs off, verbose on) select count(b) from test_range_pt where a = 30; QUERY PLAN @@ -1411,19 +1409,17 @@ explain(costs off, verbose on) select * from test_range_pt where a = 30 order by (11 rows) explain(costs off, verbose on) select count(a) from test_range_pt where a = 30; - QUERY PLAN ----------------------------------------------------------------------------------------------------- + QUERY PLAN +-------------------------------------------------------------------------------------------------------------------------- Row Adapter Output: (count(a)) -> Vector Aggregate Output: count(a) - -> Partitioned CStore Index Heap Scan on col_partition_iterator_elimination.test_range_pt + -> Partitioned CStore Index Only Scan using idx_range_local on col_partition_iterator_elimination.test_range_pt Output: a - Recheck Cond: (test_range_pt.a = 30) + Index Cond: (test_range_pt.a = 30) Selected Partitions: 3 - -> Partitioned CStore Index Ctid Scan on idx_range_local - Index Cond: (test_range_pt.a = 30) -(10 rows) +(8 rows) explain(costs off, verbose on) select count(b) from test_range_pt where a = 30; QUERY PLAN @@ -1607,19 +1603,17 @@ explain(costs off, verbose on) select * from test_range_pt where a = 30 order by (11 rows) explain(costs off, verbose on) select count(a) from test_range_pt where a = 30; - QUERY PLAN ----------------------------------------------------------------------------------------------------- + QUERY PLAN +-------------------------------------------------------------------------------------------------------------------------- Row Adapter Output: (count(a)) -> Vector Aggregate Output: count(a) - -> Partitioned CStore Index Heap Scan on col_partition_iterator_elimination.test_range_pt + -> Partitioned CStore Index Only Scan using idx_range_local on col_partition_iterator_elimination.test_range_pt Output: a - Recheck Cond: (test_range_pt.a = 30) + Index Cond: (test_range_pt.a = 30) Selected Partitions: 3 - -> Partitioned CStore Index Ctid Scan on idx_range_local - Index Cond: (test_range_pt.a = 30) -(10 rows) +(8 rows) explain(costs off, verbose on) select count(b) from test_range_pt where a = 30; QUERY PLAN diff --git a/src/test/regress/expected/force_vector_engine.out b/src/test/regress/expected/force_vector_engine.out index f3d027322d4..91dd146cfc2 100644 --- a/src/test/regress/expected/force_vector_engine.out +++ b/src/test/regress/expected/force_vector_engine.out @@ -71,16 +71,14 @@ select count(*) from force_vector_test1 where id=2 and val=2; set enable_indexscan=off; explain select count(*) from force_vector_test1 where id=2; - QUERY PLAN ----------------------------------------------------------------------------------------------------------- + QUERY PLAN +--------------------------------------------------------------------------------------------------------------------------- Row Adapter (cost=8.28..8.28 rows=1 width=8) -> Vector Aggregate (cost=8.27..8.28 rows=1 width=8) -> Vector Adapter (cost=8.27..8.27 rows=1 width=0) - -> Bitmap Heap Scan on force_vector_test1 (cost=4.26..8.27 rows=1 width=0) - Recheck Cond: (id = 2) - -> Bitmap Index Scan on force_vector_test1_id_idx (cost=0.00..4.26 rows=1 width=0) - Index Cond: (id = 2) -(7 rows) + -> Index Only Scan using force_vector_test1_id_idx on force_vector_test1 (cost=0.00..8.27 rows=1 width=0) + Index Cond: (id = 2) +(5 rows) select count(*) from force_vector_test1 where id=2; count diff --git a/src/test/regress/expected/hash_index_001.out b/src/test/regress/expected/hash_index_001.out index e44632ea39d..31d03659794 100644 --- a/src/test/regress/expected/hash_index_001.out +++ b/src/test/regress/expected/hash_index_001.out @@ -30,6 +30,14 @@ drop index if exists hash_t1_id4; NOTICE: index "hash_t1_id4" does not exist, skipping create index hash_t1_id3 on hash_table_1 using btree (id); create index hash_t1_id4 on hash_table_1 using hash (id); +explain(costs off) select id from hash_table_1 where id = 4; + QUERY PLAN +--------------------------------------------------- + [Bypass] + Index Only Scan using hash_t1_id3 on hash_table_1 + Index Cond: (id = 4) +(3 rows) + -- drop superfluous index now drop index hash_t1_id3, hash_t1_id4; -- insert into large volumns of data into hash_table_1 diff --git a/src/test/regress/expected/sqlbypass_partition.out b/src/test/regress/expected/sqlbypass_partition.out index f79e8aae0c2..e4f1768d101 100755 --- a/src/test/regress/expected/sqlbypass_partition.out +++ b/src/test/regress/expected/sqlbypass_partition.out @@ -1282,10 +1282,10 @@ reset enable_indexonlyscan; --bypass though index only scan set enable_indexscan = off; explain select col1,col2 from test_bypass_sql_partition where col1=10 and col2=10; - QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +----------------------------------------------------------------------------------------------------------------------------- [Bypass] - Partitioned Index Only Scan using itest_bypass_sql_partition on test_bypass_sql_partition (cost=10000000000.00..1000000000827.01 rows=1 width=8) + Partitioned Index Only Scan using itest_bypass_sql_partition on test_bypass_sql_partition (cost=0.00..8.27 rows=1 width=8) Index Cond: ((col1 = 10) AND (col2 = 10)) Selected Partitions: 2 (4 rows) @@ -1297,11 +1297,11 @@ select col1,col2 from test_bypass_sql_partition where col1=10 and col2=10; (1 row) explain select col1,col2 from test_bypass_sql_partition where col1=10 and col2=10 order by col1 limit 1; - QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +----------------------------------------------------------------------------------------------------------------------------------- [Bypass] - Limit (cost=10000000000.00..1000000000827.01 rows=1 width=8) - -> Partitioned Index Only Scan using itest_bypass_sql_partition on test_bypass_sql_partition (cost=10000000000.00..1000000000827.01 rows=1 width=8) + Limit (cost=0.00..8.27 rows=1 width=8) + -> Partitioned Index Only Scan using itest_bypass_sql_partition on test_bypass_sql_partition (cost=0.00..8.27 rows=1 width=8) Index Cond: ((col1 = 10) AND (col2 = 10)) Selected Partitions: 2 (5 rows) @@ -1313,11 +1313,11 @@ select col1,col2 from test_bypass_sql_partition where col1=10 and col2=10 order (1 row) explain select col1,col2 from test_bypass_sql_partition where col1=10 and col2=10 order by col1 limit 0; - QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +----------------------------------------------------------------------------------------------------------------------------------- [Bypass] - Limit (cost=10000000000.00..1000000000827.01 rows=1 width=8) - -> Partitioned Index Only Scan using itest_bypass_sql_partition on test_bypass_sql_partition (cost=10000000000.00..1000000000827.01 rows=1 width=8) + Limit (cost=0.00..8.27 rows=1 width=8) + -> Partitioned Index Only Scan using itest_bypass_sql_partition on test_bypass_sql_partition (cost=0.00..8.27 rows=1 width=8) Index Cond: ((col1 = 10) AND (col2 = 10)) Selected Partitions: 2 (5 rows) @@ -1853,10 +1853,10 @@ insert into test_bypass_sql_partition select generate_series(0,79,1), generate_s --bypass though index only scan set enable_indexscan = off; explain select col1,col2 from test_bypass_sql_partition where col1=0 order by col2; - QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +------------------------------------------------------------------------------------------------------------------------------ [Bypass] - Partitioned Index Only Scan using itest_bypass_sql_partition on test_bypass_sql_partition (cost=10000000000.00..1000000002435.51 rows=6 width=8) + Partitioned Index Only Scan using itest_bypass_sql_partition on test_bypass_sql_partition (cost=0.00..24.36 rows=6 width=8) Index Cond: (col1 = 0) Selected Partitions: 1 (4 rows) @@ -1878,11 +1878,11 @@ select col1,col2 from test_bypass_sql_partition where col1=0 order by col2; (11 rows) explain select col1,col2 from test_bypass_sql_partition where col1>0 and col1<10 order by col1 limit 10; - QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +------------------------------------------------------------------------------------------------------------------------------------ [Bypass] - Limit (cost=10000000000.00..1000000002437.01 rows=6 width=8) - -> Partitioned Index Only Scan using itest_bypass_sql_partition on test_bypass_sql_partition (cost=10000000000.00..1000000002437.01 rows=6 width=8) + Limit (cost=0.00..24.37 rows=6 width=8) + -> Partitioned Index Only Scan using itest_bypass_sql_partition on test_bypass_sql_partition (cost=0.00..24.37 rows=6 width=8) Index Cond: ((col1 > 0) AND (col1 < 10)) Selected Partitions: 1 (5 rows) @@ -1903,11 +1903,11 @@ select col1,col2 from test_bypass_sql_partition where col1>0 and col1<10 order b (10 rows) explain select col2,col1 from test_bypass_sql_partition where col1>0 and col1<10 order by col1 limit 3; - QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +------------------------------------------------------------------------------------------------------------------------------------ [Bypass] - Limit (cost=10000000000.00..505000001218.50 rows=3 width=8) - -> Partitioned Index Only Scan using itest_bypass_sql_partition on test_bypass_sql_partition (cost=10000000000.00..1000000002437.01 rows=6 width=8) + Limit (cost=0.00..12.19 rows=3 width=8) + -> Partitioned Index Only Scan using itest_bypass_sql_partition on test_bypass_sql_partition (cost=0.00..24.37 rows=6 width=8) Index Cond: ((col1 > 0) AND (col1 < 10)) Selected Partitions: 1 (5 rows) @@ -1921,11 +1921,11 @@ select col2,col1 from test_bypass_sql_partition where col1>0 and col1<10 order b (3 rows) explain select col1,col2 from test_bypass_sql_partition where col1>=0 and col1<10 and col2>0 order by col1 limit 3; - QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +------------------------------------------------------------------------------------------------------------------------------------ [Bypass] - Limit (cost=10000000000.00..1000000001234.51 rows=2 width=8) - -> Partitioned Index Only Scan using itest_bypass_sql_partition on test_bypass_sql_partition (cost=10000000000.00..1000000001234.51 rows=2 width=8) + Limit (cost=0.00..12.35 rows=2 width=8) + -> Partitioned Index Only Scan using itest_bypass_sql_partition on test_bypass_sql_partition (cost=0.00..12.35 rows=2 width=8) Index Cond: ((col1 >= 0) AND (col1 < 10) AND (col2 > 0)) Selected Partitions: 1 (5 rows) @@ -1939,11 +1939,11 @@ select col1,col2 from test_bypass_sql_partition where col1>=0 and col1<10 and co (3 rows) explain select col1,col2 from test_bypass_sql_partition where col1>=0 and col1<10 and col2>0 order by col1 limit null; - QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +------------------------------------------------------------------------------------------------------------------------------------ [Bypass] - Limit (cost=10000000000.00..1000000001234.51 rows=2 width=8) - -> Partitioned Index Only Scan using itest_bypass_sql_partition on test_bypass_sql_partition (cost=10000000000.00..1000000001234.51 rows=2 width=8) + Limit (cost=0.00..12.35 rows=2 width=8) + -> Partitioned Index Only Scan using itest_bypass_sql_partition on test_bypass_sql_partition (cost=0.00..12.35 rows=2 width=8) Index Cond: ((col1 >= 0) AND (col1 < 10) AND (col2 > 0)) Selected Partitions: 1 (5 rows) @@ -2055,13 +2055,13 @@ select col1,col2 from test_bypass_sql_partition where col1>=0 and col1<10 and co --nobypass explain select col2,col1 from test_bypass_sql_partition where col2=2 order by col1 limit 10; - QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +------------------------------------------------------------------------------------------------------------------------------------------ [No Bypass]reason: Bypass not support query in multiple partitions. - Limit (cost=10000000000.00..1000000009706.31 rows=6 width=8) - -> Partition Iterator (cost=10000000000.00..1000000009706.31 rows=6 width=8) + Limit (cost=0.00..97.06 rows=6 width=8) + -> Partition Iterator (cost=0.00..97.06 rows=6 width=8) Iterations: 8 - -> Partitioned Index Only Scan using itest_bypass_sql_partition on test_bypass_sql_partition (cost=10000000000.00..1000000009706.31 rows=6 width=8) + -> Partitioned Index Only Scan using itest_bypass_sql_partition on test_bypass_sql_partition (cost=0.00..97.06 rows=6 width=8) Index Cond: (col2 = 2) Selected Partitions: 1..8 (7 rows) @@ -2072,13 +2072,13 @@ select col2,col1 from test_bypass_sql_partition where col2=2 order by col1 limit (0 rows) explain select col1,col2 from test_bypass_sql_partition where col1 is null and col2 is null limit 10; - QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +----------------------------------------------------------------------------------------------------------------------------------------- [No Bypass]reason: Bypass not support query in zero partition. - Limit (cost=10000000000.00..1000000000827.00 rows=1 width=8) - -> Partition Iterator (cost=10000000000.00..1000000000827.00 rows=1 width=8) + Limit (cost=0.00..8.27 rows=1 width=8) + -> Partition Iterator (cost=0.00..8.27 rows=1 width=8) Iterations: 0 - -> Partitioned Index Only Scan using itest_bypass_sql_partition on test_bypass_sql_partition (cost=10000000000.00..1000000000827.00 rows=1 width=8) + -> Partitioned Index Only Scan using itest_bypass_sql_partition on test_bypass_sql_partition (cost=0.00..8.27 rows=1 width=8) Index Cond: ((col1 IS NULL) AND (col2 IS NULL)) Selected Partitions: NONE (7 rows) @@ -2089,13 +2089,13 @@ select col1,col2 from test_bypass_sql_partition where col1 is null and col2 is n (0 rows) explain select col1,col2 from test_bypass_sql_partition where col2<5 order by col1 limit 10; - QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------------------------------------ + QUERY PLAN +--------------------------------------------------------------------------------------------------------------------------------------------- [No Bypass]reason: Bypass not support query in multiple partitions. - Limit (cost=10000000000.00..35449871930.32 rows=10 width=8) - -> Partition Iterator (cost=10000000000.00..1000000018089.31 rows=389 width=8) + Limit (cost=0.00..4.65 rows=10 width=8) + -> Partition Iterator (cost=0.00..180.89 rows=389 width=8) Iterations: 8 - -> Partitioned Index Only Scan using itest_bypass_sql_partition on test_bypass_sql_partition (cost=10000000000.00..1000000018089.31 rows=389 width=8) + -> Partitioned Index Only Scan using itest_bypass_sql_partition on test_bypass_sql_partition (cost=0.00..180.89 rows=389 width=8) Index Cond: (col2 < 5) Selected Partitions: 1..8 (7 rows) @@ -2116,13 +2116,13 @@ select col1,col2 from test_bypass_sql_partition where col2<5 order by col1 limit (10 rows) explain select col1,col2 from test_bypass_sql_partition where col1>=0 and col1<=10 and col2>0 order by col1 limit 10; - QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +------------------------------------------------------------------------------------------------------------------------------------------ [No Bypass]reason: Bypass not support query in multiple partitions. - Limit (cost=10000000000.00..1000000001234.52 rows=2 width=8) - -> Partition Iterator (cost=10000000000.00..1000000001234.52 rows=2 width=8) + Limit (cost=0.00..12.35 rows=2 width=8) + -> Partition Iterator (cost=0.00..12.35 rows=2 width=8) Iterations: 2 - -> Partitioned Index Only Scan using itest_bypass_sql_partition on test_bypass_sql_partition (cost=10000000000.00..1000000001234.52 rows=2 width=8) + -> Partitioned Index Only Scan using itest_bypass_sql_partition on test_bypass_sql_partition (cost=0.00..12.35 rows=2 width=8) Index Cond: ((col1 >= 0) AND (col1 <= 10) AND (col2 > 0)) Selected Partitions: 1..2 (7 rows) diff --git a/src/test/regress/expected/vec_bitmap_1.out b/src/test/regress/expected/vec_bitmap_1.out index 920a156c984..43fd45b72ca 100644 --- a/src/test/regress/expected/vec_bitmap_1.out +++ b/src/test/regress/expected/vec_bitmap_1.out @@ -16,16 +16,15 @@ analyze vector_bitmap_table_02; ---- explain (verbose on, costs off) select count(1) from vector_bitmap_table_01; - QUERY PLAN ------------------------------------------------------------------------------------ + QUERY PLAN +----------------------------------------------------------------------------------------------------- Row Adapter Output: (count(1)) -> Vector Aggregate Output: count(1) - -> CStore Index Heap Scan on vector_bitmap_engine.vector_bitmap_table_01 +--? -> CStore Index Only Scan using bitmap_01_.* on vector_bitmap_engine.vector_bitmap_table_01 Output: 'Dummy' ---? -> CStore Index Ctid Scan on bitmap_01_.* -(7 rows) +(6 rows) select count(1) from vector_bitmap_table_01; count diff --git a/src/test/regress/sql/hash_index_001.sql b/src/test/regress/sql/hash_index_001.sql index 33b9e2b27bc..dc7fa80113e 100644 --- a/src/test/regress/sql/hash_index_001.sql +++ b/src/test/regress/sql/hash_index_001.sql @@ -28,6 +28,7 @@ drop index if exists hash_t1_id3; drop index if exists hash_t1_id4; create index hash_t1_id3 on hash_table_1 using btree (id); create index hash_t1_id4 on hash_table_1 using hash (id); +explain(costs off) select id from hash_table_1 where id = 4; -- drop superfluous index now drop index hash_t1_id3, hash_t1_id4; -- Gitee