CREATE EXTENSION IF NOT EXISTS pg_stat_statements;
SELECT pg_stat_statements_reset();

DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (id integer);
INSERT INTO t1 SELECT generate_series(1, 10_000_000);
VACUUM ANALYZE t1;

SELECT query,
  parallelized_queries_planned, parallelized_queries_launched,
  parallelized_workers_planned, parallelized_workers_launched,
  parallelized_nodes, parallelized_nodes_all_workers, parallelized_nodes_no_worker
FROM pg_stat_statements
WHERE query LIKE 'SELECT%t1%' \gx

SELECT * FROM t1 LIMIT 1;
\o /dev/null
SELECT pg_sleep(1);
\o

SELECT query,
  parallelized_queries_planned, parallelized_queries_launched,
  parallelized_workers_planned, parallelized_workers_launched,
  parallelized_nodes, parallelized_nodes_all_workers, parallelized_nodes_no_worker
FROM pg_stat_statements
WHERE query LIKE 'SELECT%t1%' \gx

SELECT count(*) FROM t1;
\o /dev/null
SELECT pg_sleep(1);
\o

SELECT query,
  parallelized_queries_planned, parallelized_queries_launched,
  parallelized_workers_planned, parallelized_workers_launched,
  parallelized_nodes, parallelized_nodes_all_workers, parallelized_nodes_no_worker
FROM pg_stat_statements
WHERE query LIKE 'SELECT%t1%' \gx

SET max_parallel_workers_per_gather TO 5;

SELECT count(*) FROM t1;
\o /dev/null
SELECT pg_sleep(1);
\o

SELECT query,
  parallelized_queries_planned, parallelized_queries_launched,
  parallelized_workers_planned, parallelized_workers_launched,
  parallelized_nodes, parallelized_nodes_all_workers, parallelized_nodes_no_worker
FROM pg_stat_statements
WHERE query LIKE 'SELECT%t1%' \gx
