Florian Schaetz <Florian.Schaetz@Optitool.DE> wrote:
>> Did you run ANALYZE on TEMP_TABLE after loading data and before
>> running your query?
>
> Nope, not yet. What will the effect be? The temp table is
> comparatively small compared to the main table (and has, yet, no
> foreign keys).
A temp table is never vacuumed or analyzed by autovacuum, so unless
you do so using explicit commands it will have default "magic
numbers" statistics. You are likely to get a better plan if you
run ANALYZE (or perhaps VACUUM ANALYZE) on the temp table after you
load data and before you use it in a query.
--
Kevin Grittner
EDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company