"Kevin Grittner" <Kevin.Grittner@xxxxxxxxxxxx> writes: > Also, make sure that you run ANALYZE against your temp table right > before running your query. Yeah. It's fairly hard to credit that temp_document_ids has any stats given the way-off estimates for it. Keep in mind that autovacuum can't help you on temp tables: since only your own session can access a temp table, you have to ANALYZE it explicitly if you need the planner to have decent stats about it. regards, tom lane -- Sent via pgsql-performance mailing list (pgsql-performance@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-performance