--SET log_temp_files = 0;

CREATE TABLE skewed1 AS
SELECT generate_series(1, 1000) % 10 AS key, 'xxxxxxxxxxxxxxxxxxxxxxxxxxxx';
INSERT INTO skewed1 SELECT generate_series(2000, 100000), 'xxxxxxxxxxxxxxxxxx';
ANALYZE skewed1;
ALTER TABLE skewed1 SET (parallel_workers = 4);

CREATE TABLE skewed2 AS
SELECT (generate_series(1, 1000) % 10) + 10 AS key, 'xxxxxxxxxxxxxxxxxxxxxxxxxxxx';
INSERT INTO skewed2 SELECT generate_series(2000, 100000), 'xxxxxxxxxxxxxxxxxx';
ANALYZE skewed2;
ALTER TABLE skewed2 SET (parallel_workers = 4);

-- parallel with parallel-aware hash join
SET max_parallel_workers_per_gather = 4;
RESET parallel_synchronization_cost;
--SET force_parallel_mode = regress;
SET force_parallel_mode = on;
SET work_mem = '256kB';
SET enable_mergejoin = false;

explain analyze
SELECT COUNT(*) FROM skewed1 r FULL OUTER JOIN skewed2 s USING (key);
SELECT COUNT(*) FROM skewed1 r FULL OUTER JOIN skewed2 s USING (key);

