smp bugfix

This commit is contained in:
l00584793
2022-06-16 15:12:00 +08:00
committed by luozihao
parent 43067d6a7b
commit f9b0018a8a
3 changed files with 46 additions and 0 deletions

View File

@ -8220,7 +8220,12 @@ static Plan* parallel_limit_sort(
plan = create_local_gather(plan);
plan = (Plan*)make_sort_from_pathkeys(root, plan, root->sort_pathkeys, -1.0);
} else {
#ifdef ENABLE_MULTIPLE_NODES
plan = create_local_gather(lefttree);
#else
plan = (Plan*)make_limit(root, lefttree, limitOffset, limitCount, offset_est, count_est, false);
plan = create_local_gather(plan);
#endif
}
return plan;

View File

@ -1127,6 +1127,40 @@ select * from t1 order by a limit 10 offset 20;
30 | 10 | 2 | 30
(10 rows)
-- test limit and offset
explain (costs off) select * from t1 limit 1;
QUERY PLAN
----------------------------------------------
Limit
-> Streaming(type: LOCAL GATHER dop: 1/2)
-> Limit
-> Seq Scan on t1
(4 rows)
explain (costs off) select * from t1 limit 1 offset 10;
QUERY PLAN
----------------------------------------------------
Limit
-> Limit
-> Streaming(type: LOCAL GATHER dop: 1/2)
-> Limit
-> Seq Scan on t1
(5 rows)
explain (costs off) select * from t1 order by 1 limit 1 offset 10;
QUERY PLAN
----------------------------------------------------------
Limit
-> Limit
-> Sort
Sort Key: a
-> Streaming(type: LOCAL GATHER dop: 1/2)
-> Limit
-> Sort
Sort Key: a
-> Seq Scan on t1
(9 rows)
--clean
set search_path=public;
drop schema test_smp cascade;

View File

@ -61,6 +61,13 @@ select * from t1 order by a limit 10;
explain (costs off) select * from t1 order by a limit 10 offset 20;
select * from t1 order by a limit 10 offset 20;
-- test limit and offset
explain (costs off) select * from t1 limit 1;
explain (costs off) select * from t1 limit 1 offset 10;
explain (costs off) select * from t1 order by 1 limit 1 offset 10;
--clean
set search_path=public;
drop schema test_smp cascade;