Allen, > I had no idea analyze was playing such a big role in this sense.. I really > thought that other than saving space, it wasn't doing much for tables that > don't have indexes on the.
Among other things, ANALYZE tells postgres how many rows are in the table. So if you add a PK constraint after loading 10 million rows without ANALYZE, PostgreSQL is likely to think that there is only one row in the table ... and choose a nested loop or some other really inefficient method of checking for uniqueness. -- Josh Berkus Aglio Database Solutions San Francisco ---------------------------(end of broadcast)--------------------------- TIP 8: explain analyze is your friend