\set on_error_stop 1;
discard temp;

do $do$
declare
	c_tables int = 3000;
	c_columns_per_table int = 10;
begin
	execute array_to_string(array(
		select $$
			create temp table t_$$ || table_id || $$ (
				$$
					|| (
						select string_agg('column_' || column_id || ' int', ', ')
						from generate_series(1, c_columns_per_table) column_id
					) || 
				$$ , primary key (column_1)
			)$$
		from generate_series(1, c_tables) table_id
	), '; ');
end;
$do$;

-- just in case they were bloated by previous tests
vacuum full analyze pg_constraint;
vacuum full analyze pg_depend;
vacuum full analyze pg_depend;
vacuum full analyze pg_constraint;
vacuum full analyze pg_attribute;
vacuum full analyze pg_class;
vacuum full analyze pg_namespace;

explain analyze table information_schema.constraint_column_usage;
