echo > NN.dat
for n in 1 2 3 4 5 6 7 8
do
	psql -c "drop table if exists x;"
	psql -c "select (random()*1e0)::int as i into x from generate_series(1, '1e$n'::float8::int);"
	psql -c "vacuum analyze x;"
	sleep 2
	psql -t -A -c 'explain (analyze on, FORMAT json)  select * from x order by
	i;' | perl p.pl 1e$n >> NN.dat
done
gnuplot -p NN.plt
