CREATE EXTENSION IF NOT EXISTS pg_plan_tree_dot; CREATE TABLE testtable1 (C1 int, C2 int); INSERT INTO testtable1 (C1, C2) SELECT i, i FROM generate_series(0, 10000) AS i; -- SELECT C2 FROM testtable1 ORDER BY C1; SELECT generate_plan_tree_dot('SELECT C2 FROM testtable1 ORDER BY C1;', 'sample-sort.dot'); DROP TABLE testtable1 CASCADE;