SELECT 150 as columns \gset
SELECT 60 as tables \gset 

SELECT (SELECT 'CREATE TABLE t'||n||' ('|| string_agg(c, ',') ||')' FROM (SELECT 'c'||n||' int' as c from generate_series(1, :columns) as n))
FROM generate_series(1, :tables) as n \gexec


SELECT 'CREATE VIEW v1 AS SELECT FROM '|| string_agg(t, ' ') FROM (
SELECT 't'||n||' JOIN t'||n+1||' USING (c1)' as t FROM generate_series(1, 1) as n
UNION ALL
SELECT  'JOIN t'||n||' USING (c1)' FROM generate_series(3, :tables) as n) as n \gexec

\timing
SELECT FROM v1 WHERE false;
EXPLAIN SELECT FROM v1 WHERE false;

SELECT FROM v1 WHERE false;
EXPLAIN SELECT FROM v1 WHERE false;

SELECT FROM v1 WHERE false;
EXPLAIN SELECT FROM v1 WHERE false;

