Oleg Bartunov <oleg@sai.msu.su> writes:
> I found the problem. I modified my test script to add 'vacuum analyze'
> after creating test data and it works really fast ! Great !
> Now I'm wondering why do I need vacuum analyze after creating test data
> and indices ?
VACUUM ANALYZE would create pg_statistics entries for the tables,
which'd allow the optimizer to make better estimates of restriction
and join selectivities. I expect that it changes the plan being used;
what does EXPLAIN say with and without the analyze?
regards, tom lane