create table d1 (id int primary key, padding text);
create table d2 (id int primary key, padding text);
create table d3 (id int primary key, padding text);
create table d4 (id int primary key, padding text);
create table d5 (id int primary key, padding text);
create table d6 (id int primary key, padding text);
create table d7 (id int primary key, padding text);
create table d8 (id int primary key, padding text);
create table d9 (id int primary key, padding text);
create table d10 (id int primary key, padding text);
create table d11 (id int primary key, padding text);
create table d12 (id int primary key, padding text);
create table d13 (id int primary key, padding text);
create table d14 (id int primary key, padding text);
create table d15 (id int primary key, padding text);

create table f (id int primary key,
				id1 int not null references d1(id),
				id2 int not null references d2(id),
				id3 int not null references d3(id),
				id4 int not null references d4(id),
				id5 int not null references d5(id),
				id6 int not null references d6(id),
				id7 int not null references d7(id),
                                id8 int not null references d8(id),
                                id9 int not null references d9(id),
                                id10 int not null references d10(id),
                                id11 int not null references d11(id),
                                id12 int not null references d12(id),
                                id13 int not null references d13(id),
                                id14 int not null references d14(id),
                                id15 int not null references d15(id),
				padding text);

insert into d1 select i, md5(i::text) from generate_series(1, 1000) s(i);
insert into d2 select i, md5(i::text) from generate_series(1, 1000) s(i);
insert into d3 select i, md5(i::text) from generate_series(1, 1000) s(i);
insert into d4 select i, md5(i::text) from generate_series(1, 1000) s(i);
insert into d5 select i, md5(i::text) from generate_series(1, 1000) s(i);
insert into d6 select i, md5(i::text) from generate_series(1, 1000) s(i);
insert into d7 select i, md5(i::text) from generate_series(1, 1000) s(i);
insert into d8 select i, md5(i::text) from generate_series(1, 1000) s(i);
insert into d9 select i, md5(i::text) from generate_series(1, 1000) s(i);
insert into d10 select i, md5(i::text) from generate_series(1, 1000) s(i);
insert into d11 select i, md5(i::text) from generate_series(1, 1000) s(i);
insert into d12 select i, md5(i::text) from generate_series(1, 1000) s(i);
insert into d13 select i, md5(i::text) from generate_series(1, 1000) s(i);
insert into d14 select i, md5(i::text) from generate_series(1, 1000) s(i);
insert into d15 select i, md5(i::text) from generate_series(1, 1000) s(i);

-- insert into f
-- select i,
-- 	mod(i * 11, 1000) + 1, -- d1
-- 	mod(i * 13, 1000) + 1, -- d2
-- 	mod(i * 17, 1000) + 1, -- d3
-- 	mod(i * 23, 1000) + 1, -- d4
-- 	mod(i * 29, 1000) + 1, -- d5
-- 	mod(i * 31, 1000) + 1, -- d6
-- 	mod(i * 37, 1000) + 1, -- d7
-- 	md5(i::text)
-- from generate_series(1, 1000000) s(i);

vacuum;
vacuum freeze;
analyze;
checkpoint;
