From 023a89ddff4c61d27b9f62a41950fca96f3c7477 Mon Sep 17 00:00:00 2001 From: zhaosen Date: Thu, 1 Aug 2024 18:26:13 +0800 Subject: [PATCH] parallel_index_scan for ustore test case --- .../input/ustore_parallel_index.source | 95 ++++ .../output/ustore_parallel_index.source | 460 ++++++++++++++++++ 2 files changed, 555 insertions(+) create mode 100644 src/test/regress/input/ustore_parallel_index.source create mode 100644 src/test/regress/output/ustore_parallel_index.source diff --git a/src/test/regress/input/ustore_parallel_index.source b/src/test/regress/input/ustore_parallel_index.source new file mode 100644 index 0000000000..d2c6622e17 --- /dev/null +++ b/src/test/regress/input/ustore_parallel_index.source @@ -0,0 +1,95 @@ +DROP TABLE IF EXISTS ustore_parallel_index_01; +DROP TABLE IF EXISTS ustore_parallel_index_02; +-- create test table and index +CREATE TABLE ustore_parallel_index_01(a int, b int) with(storage_type = ustore); +INSERT INTO ustore_parallel_index_01 VALUES (generate_series(1, 1000000), generate_series(1,1000000)); +CREATE INDEX ustore_index_parallel_index_01 ON ustore_parallel_index_01(a); +CREATE TABLE ustore_parallel_index_02(a int, b int) with(storage_type = ustore); +INSERT INTO ustore_parallel_index_02 VALUES (generate_series(1,10), generate_series(1,10)); + +-- 1.Bitmap HeapScan Operatore +SET enable_seqscan = OFF; +SET enable_indexscan = OFF; +SET enable_indexonlyscan = OFF; +SET enable_bitmapscan = ON; +SET enable_nestloop = OFF; +SET query_dop = 2; + + +-- parallel bitmap heapScan in equality case +EXPLAIN (COSTS OFF) SELECT * FROM ustore_parallel_index_01 WHERE a=100; +EXPLAIN (COSTS OFF) SELECT * FROM ustore_parallel_index_01 WHERE a=100 AND a=10000; +EXPLAIN (COSTS OFF) SELECT * FROM ustore_parallel_index_01 WHERE a=100 AND b=100; +EXPLAIN (COSTS OFF) SELECT * FROM ustore_parallel_index_01 WHERE a=100 AND b=200; + +-- ustore parallel bitmap heap in scope case +EXPLAIN SELECT * FROM ustore_parallel_index_01 where a>0 and a <2000 or a>9999 and a <8000 and a<24; +EXPLAIN (COSTS OFF) SELECT COUNT(b) FROM ustore_parallel_index_01 WHERE a<10000; +SELECT COUNT(b) FROM ustore_parallel_index_01 WHERE a<10000; +EXPLAIN (COSTS OFF) SELECT COUNT(b) FROM ustore_parallel_index_01 WHERE a>10000 AND a<20000; +SELECT COUNT(b) FROM ustore_parallel_index_01 WHERE a>10000 AND a<20000; +EXPLAIN (COSTS OFF) SELECT * FROM ustore_parallel_index_01 WHERE a in (1000,10000,100000) ORDER BY a; +SELECT * FROM ustore_parallel_index_01 WHERE a in (1000,10000,100000) ORDER BY a; +EXPLAIN (COSTS OFF) SELECT * FROM ustore_parallel_index_01 JOIN ustore_parallel_index_02 ON ustore_parallel_index_01.a<100 and ustore_parallel_index_01.a=ustore_parallel_index_02.a ORDER BY ustore_parallel_index_01.a; +SELECT * FROM ustore_parallel_index_01 JOIN ustore_parallel_index_02 ON ustore_parallel_index_01.a<100 and ustore_parallel_index_01.a=ustore_parallel_index_02.a ORDER BY ustore_parallel_index_01.a; + +-- ubtree with undo case +START TRANSACTION; +UPDATE ustore_parallel_index_01 SET b = b + 1 WHERE a <= 10; +SELECT * FROM ustore_parallel_index_01 WHERE a <= 10; +COMMIT; +EXPLAIN (COSTS OFF) SELECT * FROM ustore_parallel_index_01 WHERE a <= 10; +SELECT * FROM ustore_parallel_index_01 WHERE a <= 10; + +EXPLAIN (COSTS OFF) SELECT * FROM ustore_parallel_index_01 WHERE a < 20 and a > 10; +START TRANSACTION; +UPDATE ustore_parallel_index_01 SET a = a + 1 WHERE a < 20 and a > 10; +SELECT * FROM ustore_parallel_index_01 WHERE a < 20 and a > 10; +ROLLBACK; +SELECT * FROM ustore_parallel_index_01 WHERE a < 20 and a > 10; + +-- 2.Index Only Scan Operatore & Index Scan Operatore +SET enable_seqscan = OFF; +SET enable_indexscan = ON; +SET enable_indexonlyscan = ON; +SET enable_bitmapscan = OFF; +CREATE INDEX ustore_index_parallel_index_02 ON ustore_parallel_index_02(a); + +-- parallel index scan and index only scan in equality case +EXPLAIN (COSTS OFF) SELECT /*+ set(query_dop 1002) */ * FROM ustore_parallel_index_01 WHERE a=1000; +EXPLAIN (COSTS OFF) SELECT /*+ set(query_dop 1002) */ * FROM ustore_parallel_index_02 WHERE a=1000 AND a=2000; +EXPLAIN (COSTS OFF) SELECT /*+ set(query_dop 1002) */ COUNT(*) FROM ustore_parallel_index_01 WHERE a=100000 AND a=0; +EXPLAIN (COSTS OFF) SELECT /*+ set(query_dop 1002) */ COUNT(*) FROM ustore_parallel_index_02 WHERE a>10000 AND b<20000; + +-- ustore parallel index scan and index only scan in scope case +EXPLAIN (COSTS OFF) SELECT COUNT(*) FROM ustore_parallel_index_01 WHERE a>1000; +SELECT COUNT(*) FROM ustore_parallel_index_01 WHERE a>1000; +EXPLAIN (COSTS OFF) SELECT COUNT(b) FROM ustore_parallel_index_01 WHERE a>10000 AND a<20000; +SELECT COUNT(b) FROM ustore_parallel_index_01 WHERE a>10000 AND a<20000; +EXPLAIN (COSTS OFF) SELECT * FROM ustore_parallel_index_01 WHERE a in (1000,10000,100000) ORDER BY a; +SELECT * FROM ustore_parallel_index_01 WHERE a in (1000,10000,100000) ORDER BY a; +EXPLAIN (COSTS OFF) SELECT * FROM ustore_parallel_index_01 JOIN ustore_parallel_index_02 ON ustore_parallel_index_01.a<100 and ustore_parallel_index_01.a=ustore_parallel_index_02.b ORDER BY ustore_parallel_index_01.b; +SELECT * FROM ustore_parallel_index_01 JOIN ustore_parallel_index_02 ON ustore_parallel_index_01.a<100 and ustore_parallel_index_01.a=ustore_parallel_index_02.b ORDER BY ustore_parallel_index_01.b; + +-- ubtree with undo case +START TRANSACTION; +UPDATE ustore_parallel_index_01 SET b = b + 1 WHERE a <= 10; +SELECT * FROM ustore_parallel_index_01 WHERE a <= 10; +COMMIT; +EXPLAIN (COSTS OFF) SELECT * FROM ustore_parallel_index_01 WHERE a <= 10; +SELECT * FROM ustore_parallel_index_01 WHERE a <= 10; + +START TRANSACTION; +UPDATE ustore_parallel_index_01 SET a = a + 1 WHERE a < 20 and a > 10; +SELECT * FROM ustore_parallel_index_01 WHERE a < 20 and a > 10; +ROLLBACK; +SELECT * FROM ustore_parallel_index_01 WHERE a < 20 and a > 10; + +--cleanup env +RESET enable_seqscan; +RESET enable_indexscan; +RESET enable_indexonlyscan; +RESET enable_bitmapscan; +RESET query_dop; +RESET smp_thread_cost; +RESET enable_nestloop; diff --git a/src/test/regress/output/ustore_parallel_index.source b/src/test/regress/output/ustore_parallel_index.source new file mode 100644 index 0000000000..91eb939809 --- /dev/null +++ b/src/test/regress/output/ustore_parallel_index.source @@ -0,0 +1,460 @@ +DROP TABLE IF EXISTS ustore_parallel_index_01; +NOTICE: table "ustore_parallel_index_01" does not exist, skipping +DROP TABLE IF EXISTS ustore_parallel_index_02; +NOTICE: table "ustore_parallel_index_02" does not exist, skipping +-- create test table and index +CREATE TABLE ustore_parallel_index_01(a int, b int) with(storage_type = ustore); +INSERT INTO ustore_parallel_index_01 VALUES (generate_series(1, 1000000), generate_series(1,1000000)); +CREATE INDEX ustore_index_parallel_index_01 ON ustore_parallel_index_01(a); +CREATE TABLE ustore_parallel_index_02(a int, b int) with(storage_type = ustore); +INSERT INTO ustore_parallel_index_02 VALUES (generate_series(1,10), generate_series(1,10)); +-- 1.Bitmap HeapScan Operatore +SET enable_seqscan = OFF; +SET enable_indexscan = OFF; +SET enable_indexonlyscan = OFF; +SET enable_bitmapscan = ON; +SET enable_nestloop = OFF; +SET query_dop = 2; +-- parallel bitmap heapScan in equality case +EXPLAIN (COSTS OFF) SELECT * FROM ustore_parallel_index_01 WHERE a=100; + QUERY PLAN +----------------------------------------------------------------- + Streaming(type: LOCAL GATHER dop: 1/2) + -> Bitmap Heap Scan on ustore_parallel_index_01 + Recheck Cond: (a = 100) + -> Bitmap Index Scan on ustore_index_parallel_index_01 + Index Cond: (a = 100) +(5 rows) + +EXPLAIN (COSTS OFF) SELECT * FROM ustore_parallel_index_01 WHERE a=100 AND a=10000; + QUERY PLAN +----------------------------------------------------------------------- + Streaming(type: LOCAL GATHER dop: 1/2) + -> Result + One-Time Filter: false + -> Bitmap Heap Scan on ustore_parallel_index_01 + Recheck Cond: (a = 100) + -> Bitmap Index Scan on ustore_index_parallel_index_01 + Index Cond: (a = 100) +(7 rows) + +EXPLAIN (COSTS OFF) SELECT * FROM ustore_parallel_index_01 WHERE a=100 AND b=100; + QUERY PLAN +----------------------------------------------------------------- + Streaming(type: LOCAL GATHER dop: 1/2) + -> Bitmap Heap Scan on ustore_parallel_index_01 + Recheck Cond: (a = 100) + Filter: (b = 100) + -> Bitmap Index Scan on ustore_index_parallel_index_01 + Index Cond: (a = 100) +(6 rows) + +EXPLAIN (COSTS OFF) SELECT * FROM ustore_parallel_index_01 WHERE a=100 AND b=200; + QUERY PLAN +----------------------------------------------------------------- + Streaming(type: LOCAL GATHER dop: 1/2) + -> Bitmap Heap Scan on ustore_parallel_index_01 + Recheck Cond: (a = 100) + Filter: (b = 200) + -> Bitmap Index Scan on ustore_index_parallel_index_01 + Index Cond: (a = 100) +(6 rows) + +-- ustore parallel bitmap heap in scope case +EXPLAIN SELECT * FROM ustore_parallel_index_01 where a>0 and a <2000 or a>9999 and a <8000 and a<24; + QUERY PLAN +-------------------------------------------------------------------------------------------------------------- + Streaming(type: LOCAL GATHER dop: 1/2) (cost=277.99..3027.98 rows=9975 width=8) + -> Bitmap Heap Scan on ustore_parallel_index_01 (cost=277.99..3008.99 rows=9975 width=8) + Recheck Cond: (((a > 0) AND (a < 2000)) OR ((a > 9999) AND (a < 8000) AND (a < 24))) + -> BitmapOr (cost=277.99..277.99 rows=10000 width=0) + -> Bitmap Index Scan on ustore_index_parallel_index_01 (cost=0.00..130.25 rows=5000 width=0) + Index Cond: ((a > 0) AND (a < 2000)) + -> Bitmap Index Scan on ustore_index_parallel_index_01 (cost=0.00..142.75 rows=5000 width=0) + Index Cond: ((a > 9999) AND (a < 8000) AND (a < 24)) +(8 rows) + +EXPLAIN (COSTS OFF) SELECT COUNT(b) FROM ustore_parallel_index_01 WHERE a<10000; + QUERY PLAN +----------------------------------------------------------------------------- + Aggregate + -> Streaming(type: LOCAL GATHER dop: 1/2) + -> Aggregate + -> Bitmap Heap Scan on ustore_parallel_index_01 + Recheck Cond: (a < 10000) + -> Bitmap Index Scan on ustore_index_parallel_index_01 + Index Cond: (a < 10000) +(7 rows) + +SELECT COUNT(b) FROM ustore_parallel_index_01 WHERE a<10000; + count +------- + 9999 +(1 row) + +EXPLAIN (COSTS OFF) SELECT COUNT(b) FROM ustore_parallel_index_01 WHERE a>10000 AND a<20000; + QUERY PLAN +----------------------------------------------------------------------------- + Aggregate + -> Streaming(type: LOCAL GATHER dop: 1/2) + -> Aggregate + -> Bitmap Heap Scan on ustore_parallel_index_01 + Recheck Cond: ((a > 10000) AND (a < 20000)) + -> Bitmap Index Scan on ustore_index_parallel_index_01 + Index Cond: ((a > 10000) AND (a < 20000)) +(7 rows) + +SELECT COUNT(b) FROM ustore_parallel_index_01 WHERE a>10000 AND a<20000; + count +------- + 9999 +(1 row) + +EXPLAIN (COSTS OFF) SELECT * FROM ustore_parallel_index_01 WHERE a in (1000,10000,100000) ORDER BY a; + QUERY PLAN +------------------------------------------------------------------------------ + Sort + Sort Key: a + -> Streaming(type: LOCAL GATHER dop: 1/2) + -> Bitmap Heap Scan on ustore_parallel_index_01 + Recheck Cond: (a = ANY ('{1000,10000,100000}'::integer[])) + -> Bitmap Index Scan on ustore_index_parallel_index_01 + Index Cond: (a = ANY ('{1000,10000,100000}'::integer[])) +(7 rows) + +SELECT * FROM ustore_parallel_index_01 WHERE a in (1000,10000,100000) ORDER BY a; + a | b +--------+-------- + 1000 | 1000 + 10000 | 10000 + 100000 | 100000 +(3 rows) + +EXPLAIN (COSTS OFF) SELECT * FROM ustore_parallel_index_01 JOIN ustore_parallel_index_02 ON ustore_parallel_index_01.a<100 and ustore_parallel_index_01.a=ustore_parallel_index_02.a ORDER BY ustore_parallel_index_01.a; + QUERY PLAN +----------------------------------------------------------------------------------------- + Sort + Sort Key: ustore_parallel_index_01.a + -> Streaming(type: LOCAL GATHER dop: 1/2) + -> Hash Join + Hash Cond: (ustore_parallel_index_02.a = ustore_parallel_index_01.a) + -> Streaming(type: LOCAL REDISTRIBUTE dop: 2/1) + -> Seq Scan on ustore_parallel_index_02 + Filter: (a < 100) + -> Hash + -> Streaming(type: LOCAL REDISTRIBUTE dop: 2/2) + -> Bitmap Heap Scan on ustore_parallel_index_01 + Recheck Cond: (a < 100) + -> Bitmap Index Scan on ustore_index_parallel_index_01 + Index Cond: (a < 100) +(14 rows) + +SELECT * FROM ustore_parallel_index_01 JOIN ustore_parallel_index_02 ON ustore_parallel_index_01.a<100 and ustore_parallel_index_01.a=ustore_parallel_index_02.a ORDER BY ustore_parallel_index_01.a; + a | b | a | b +----+----+----+---- + 1 | 1 | 1 | 1 + 2 | 2 | 2 | 2 + 3 | 3 | 3 | 3 + 4 | 4 | 4 | 4 + 5 | 5 | 5 | 5 + 6 | 6 | 6 | 6 + 7 | 7 | 7 | 7 + 8 | 8 | 8 | 8 + 9 | 9 | 9 | 9 + 10 | 10 | 10 | 10 +(10 rows) + +-- ubtree with undo case +START TRANSACTION; +UPDATE ustore_parallel_index_01 SET b = b + 1 WHERE a <= 10; +SELECT * FROM ustore_parallel_index_01 WHERE a <= 10; + a | b +----+---- + 1 | 2 + 2 | 3 + 3 | 4 + 4 | 5 + 5 | 6 + 6 | 7 + 7 | 8 + 8 | 9 + 9 | 10 + 10 | 11 +(10 rows) + +COMMIT; +EXPLAIN (COSTS OFF) SELECT * FROM ustore_parallel_index_01 WHERE a <= 10; + QUERY PLAN +----------------------------------------------------------------- + Streaming(type: LOCAL GATHER dop: 1/2) + -> Bitmap Heap Scan on ustore_parallel_index_01 + Recheck Cond: (a <= 10) + -> Bitmap Index Scan on ustore_index_parallel_index_01 + Index Cond: (a <= 10) +(5 rows) + +SELECT * FROM ustore_parallel_index_01 WHERE a <= 10; + a | b +----+---- + 1 | 2 + 2 | 3 + 3 | 4 + 4 | 5 + 5 | 6 + 6 | 7 + 7 | 8 + 8 | 9 + 9 | 10 + 10 | 11 +(10 rows) + +EXPLAIN (COSTS OFF) SELECT * FROM ustore_parallel_index_01 WHERE a < 20 and a > 10; + QUERY PLAN +----------------------------------------------------------------- + Streaming(type: LOCAL GATHER dop: 1/2) + -> Bitmap Heap Scan on ustore_parallel_index_01 + Recheck Cond: ((a < 20) AND (a > 10)) + -> Bitmap Index Scan on ustore_index_parallel_index_01 + Index Cond: ((a < 20) AND (a > 10)) +(5 rows) + +START TRANSACTION; +UPDATE ustore_parallel_index_01 SET a = a + 1 WHERE a < 20 and a > 10; +SELECT * FROM ustore_parallel_index_01 WHERE a < 20 and a > 10; + a | b +----+---- + 12 | 11 + 13 | 12 + 14 | 13 + 15 | 14 + 16 | 15 + 17 | 16 + 18 | 17 + 19 | 18 +(8 rows) + +ROLLBACK; +SELECT * FROM ustore_parallel_index_01 WHERE a < 20 and a > 10; + a | b +----+---- + 11 | 11 + 12 | 12 + 13 | 13 + 14 | 14 + 15 | 15 + 16 | 16 + 17 | 17 + 18 | 18 + 19 | 19 +(9 rows) + +-- 2.Index Only Scan Operatore & Index Scan Operatore +SET enable_seqscan = OFF; +SET enable_indexscan = ON; +SET enable_indexonlyscan = ON; +SET enable_bitmapscan = OFF; +CREATE INDEX ustore_index_parallel_index_02 ON ustore_parallel_index_02(a); +-- parallel index scan and index only scan in equality case +EXPLAIN (COSTS OFF) SELECT /*+ set(query_dop 1002) */ * FROM ustore_parallel_index_01 WHERE a=1000; + QUERY PLAN +----------------------------------------------------------------------------------- + Streaming(type: LOCAL GATHER dop: 1/2) + -> Index Scan using ustore_index_parallel_index_01 on ustore_parallel_index_01 + Index Cond: (a = 1000) +(3 rows) + +EXPLAIN (COSTS OFF) SELECT /*+ set(query_dop 1002) */ * FROM ustore_parallel_index_02 WHERE a=1000 AND a=2000; + QUERY PLAN +----------------------------------------------------------------------------------------- + Streaming(type: LOCAL GATHER dop: 1/2) + -> Result + One-Time Filter: false + -> Index Scan using ustore_index_parallel_index_02 on ustore_parallel_index_02 + Index Cond: (a = 1000) +(5 rows) + +EXPLAIN (COSTS OFF) SELECT /*+ set(query_dop 1002) */ COUNT(*) FROM ustore_parallel_index_01 WHERE a=100000 AND a=0; + QUERY PLAN +---------------------------------------------------------------------------------------------------------- + Aggregate + -> Streaming(type: LOCAL GATHER dop: 1/2) + -> Aggregate + -> Result + One-Time Filter: false + -> Index Only Scan using ustore_index_parallel_index_01 on ustore_parallel_index_01 + Index Cond: (a = 100000) +(7 rows) + +EXPLAIN (COSTS OFF) SELECT /*+ set(query_dop 1002) */ COUNT(*) FROM ustore_parallel_index_02 WHERE a>10000 AND b<20000; + QUERY PLAN +----------------------------------------------------------------------------------------------- + Aggregate + -> Streaming(type: LOCAL GATHER dop: 1/2) + -> Aggregate + -> Index Scan using ustore_index_parallel_index_02 on ustore_parallel_index_02 + Index Cond: (a > 10000) + Filter: (b < 20000) +(6 rows) + +-- ustore parallel index scan and index only scan in scope case +EXPLAIN (COSTS OFF) SELECT COUNT(*) FROM ustore_parallel_index_01 WHERE a>1000; + QUERY PLAN +---------------------------------------------------------------------------------------------------- + Aggregate + -> Streaming(type: LOCAL GATHER dop: 1/2) + -> Aggregate + -> Index Only Scan using ustore_index_parallel_index_01 on ustore_parallel_index_01 + Index Cond: (a > 1000) +(5 rows) + +SELECT COUNT(*) FROM ustore_parallel_index_01 WHERE a>1000; + count +-------- + 999000 +(1 row) + +EXPLAIN (COSTS OFF) SELECT COUNT(b) FROM ustore_parallel_index_01 WHERE a>10000 AND a<20000; + QUERY PLAN +----------------------------------------------------------------------------------------------- + Aggregate + -> Streaming(type: LOCAL GATHER dop: 1/2) + -> Aggregate + -> Index Scan using ustore_index_parallel_index_01 on ustore_parallel_index_01 + Index Cond: ((a > 10000) AND (a < 20000)) +(5 rows) + +SELECT COUNT(b) FROM ustore_parallel_index_01 WHERE a>10000 AND a<20000; + count +------- + 9999 +(1 row) + +EXPLAIN (COSTS OFF) SELECT * FROM ustore_parallel_index_01 WHERE a in (1000,10000,100000) ORDER BY a; + QUERY PLAN +----------------------------------------------------------------------------------------- + Sort + Sort Key: a + -> Streaming(type: LOCAL GATHER dop: 1/2) + -> Index Scan using ustore_index_parallel_index_01 on ustore_parallel_index_01 + Index Cond: (a = ANY ('{1000,10000,100000}'::integer[])) +(5 rows) + +SELECT * FROM ustore_parallel_index_01 WHERE a in (1000,10000,100000) ORDER BY a; + a | b +--------+-------- + 1000 | 1000 + 10000 | 10000 + 100000 | 100000 +(3 rows) + +EXPLAIN (COSTS OFF) SELECT * FROM ustore_parallel_index_01 JOIN ustore_parallel_index_02 ON ustore_parallel_index_01.a<100 and ustore_parallel_index_01.a=ustore_parallel_index_02.b ORDER BY ustore_parallel_index_01.b; + QUERY PLAN +----------------------------------------------------------------------------------------------------- + Sort + Sort Key: ustore_parallel_index_01.b + -> Streaming(type: LOCAL GATHER dop: 1/2) + -> Hash Join + Hash Cond: (ustore_parallel_index_02.b = ustore_parallel_index_01.a) + -> Streaming(type: BROADCAST dop: 2/1) + -> Seq Scan on ustore_parallel_index_02 + Filter: (b < 100) + -> Hash + -> Index Scan using ustore_index_parallel_index_01 on ustore_parallel_index_01 + Index Cond: (a < 100) +(11 rows) + +SELECT * FROM ustore_parallel_index_01 JOIN ustore_parallel_index_02 ON ustore_parallel_index_01.a<100 and ustore_parallel_index_01.a=ustore_parallel_index_02.b ORDER BY ustore_parallel_index_01.b; + a | b | a | b +----+----+----+---- + 1 | 2 | 1 | 1 + 2 | 3 | 2 | 2 + 3 | 4 | 3 | 3 + 4 | 5 | 4 | 4 + 5 | 6 | 5 | 5 + 6 | 7 | 6 | 6 + 7 | 8 | 7 | 7 + 8 | 9 | 8 | 8 + 9 | 10 | 9 | 9 + 10 | 11 | 10 | 10 +(10 rows) + +-- ubtree with undo case +START TRANSACTION; +UPDATE ustore_parallel_index_01 SET b = b + 1 WHERE a <= 10; +SELECT * FROM ustore_parallel_index_01 WHERE a <= 10; + a | b +----+---- + 1 | 3 + 2 | 4 + 3 | 5 + 4 | 6 + 5 | 7 + 6 | 8 + 7 | 9 + 8 | 10 + 9 | 11 + 10 | 12 +(10 rows) + +COMMIT; +EXPLAIN (COSTS OFF) SELECT * FROM ustore_parallel_index_01 WHERE a <= 10; + QUERY PLAN +----------------------------------------------------------------------------------- + Streaming(type: LOCAL GATHER dop: 1/2) + -> Index Scan using ustore_index_parallel_index_01 on ustore_parallel_index_01 + Index Cond: (a <= 10) +(3 rows) + +SELECT * FROM ustore_parallel_index_01 WHERE a <= 10; + a | b +----+---- + 1 | 3 + 2 | 4 + 3 | 5 + 4 | 6 + 5 | 7 + 6 | 8 + 7 | 9 + 8 | 10 + 9 | 11 + 10 | 12 +(10 rows) + +START TRANSACTION; +UPDATE ustore_parallel_index_01 SET a = a + 1 WHERE a < 20 and a > 10; +SELECT * FROM ustore_parallel_index_01 WHERE a < 20 and a > 10; + a | b +----+---- + 12 | 11 + 13 | 12 + 14 | 13 + 15 | 14 + 16 | 15 + 17 | 16 + 18 | 17 + 19 | 18 +(8 rows) + +ROLLBACK; +SELECT * FROM ustore_parallel_index_01 WHERE a < 20 and a > 10; + a | b +----+---- + 11 | 11 + 12 | 12 + 13 | 13 + 14 | 14 + 15 | 15 + 16 | 16 + 17 | 17 + 18 | 18 + 19 | 19 +(9 rows) + +--cleanup env +RESET enable_seqscan; +RESET enable_indexscan; +RESET enable_indexonlyscan; +RESET enable_bitmapscan; +RESET query_dop; +RESET smp_thread_cost; +RESET enable_nestloop; -- Gitee