drop table tprt cascade;
drop table tbl1;

-- Join
create table tbl1(col1 int);
--insert into tbl1 values (5001), (5005);
insert into tbl1 values (generate_series(1001,100000));

-- Basic table
create table tprt (col1 int) partition by range (col1);
create table tprt_01 partition of tprt for values from (1) to (10001);
create table tprt_02 partition of tprt for values from (10001) to (20001);
create table tprt_03 partition of tprt for values from (20001) to (30001);
create table tprt_04 partition of tprt for values from (30001) to (40001);
create table tprt_05 partition of tprt for values from (40001) to (50001);
create table tprt_06 partition of tprt for values from (50001) to (60001);
create table tprt_07 partition of tprt for values from (60001) to (70001);
create table tprt_08 partition of tprt for values from (70001) to (80001);
create table tprt_09 partition of tprt for values from (80001) to (90001);
create table tprt_10 partition of tprt for values from (90001) to (100001);
create table tprt_11 partition of tprt for values from (100001) to (110001);

-- insert into tprt values (10), (20), (501), (502), (505), (1001), (4500);
--insert into tprt values (100), (200), (5001), (5002), (5005), (10001), (45000);
insert into tprt values (generate_series(100,110000));

set enable_hashjoin = off;
set enable_mergejoin = off;
set jit_optimize_above_cost = 1;
set jit_inline_above_cost = 1;
set parallel_setup_cost=0;
set parallel_tuple_cost=0;
-- min_parallel_table_scan_size = 1
set max_parallel_workers_per_gather = 100;
set max_parallel_workers = 100;

set statement_timeout = 500;

explain analyze select tbl1.col1, tprt.col1 from tbl1
inner join tprt on tbl1.col1 = tprt.col1
order by tbl1.col1, tprt.col1;
