print "CREATE TABLE pktest(a int unique);\n";
print "CREATE TABLE fktest(b int);\n";
print "COPY pktest FROM STDIN;\n";

for ($i=0; $i<1000000; $i++) {
 print "$i\n";
}
print "\\.\n";

print "COPY fktest FROM STDIN;\n";
print "1\n\\.\n";

print "set sort_mem=50000;\n";
print "update pg_class set reltuples=1000000 where relname='pktest';\n";
print "explain select * from fktest where b not in (select a from pktest);\n";
print "explain analyze select * from fktest where b not in (select a from pktest);\n";
print "update pg_class set reltuples=100000 where relname='pktest';\n";
print "explain select * from fktest where b not in (select a from pktest);\n";
print "explain analyze select * from fktest where b not in (select a from pktest);\n";
print "update pg_class set reltuples=10000 where relname='pktest';\n";
print "explain select * from fktest where b not in (select a from pktest);\n";
print "explain analyze select * from fktest where b not in (select a from pktest);\n";
print "update pg_class set reltuples=1000 where relname='pktest';\n";
print "explain select * from fktest where b not in (select a from pktest);\n";
print "explain analyze select * from fktest where b not in (select a from pktest);\n";

