-- drop table td, m2, m3;

create table td (id int not null primary key, mid int not null);
create table m2 (id int not null primary key);
create table m3 (id int not null primary key) inherits (m2);

vacuum analyze;
explain analyze select * from td join m2 on m2.id = td.mid where td.id = 12345;

insert into td select a, a from (select generate_series(1,20000)) as x (a);
vacuum analyze;
explain analyze select * from td join m2 on m2.id = td.mid where td.id = 12345;

insert into m2 select a from (select generate_series(1,20000)) as x (a);
vacuum analyze;
explain analyze select * from td join m2 on m2.id = td.mid where td.id = 12345;

insert into m3 select a from (select generate_series(1,20000)) as x (a);
vacuum analyze;
explain analyze select * from td join m2 on m2.id = td.mid where td.id = 12345;

