> Easy first question: is the temp table analyzed before being used in a join ? No, I haven't done that. Today, I tried to run ANALYZE records_to_filter_on; on the same sample data set (3.75 million rows) before the join, and it did not seem to make much of a difference in terms of time (new output of EXPLAIN ANALYZE at https://explain.dalibo.com/plan/YZu - it seems very similar to me). Not sure if it is relevant, but I did some experimentation with smaller samples, and for those, there was a significant speedup. Could there be some size threshold on the temp table after which running ANALYZE does not yield any speedup? > I think the attachment is missing. Added now. Simen
Attachment:
explain_analyze.json
Description: explain_analyze.json
Attachment:
pg_settings.conf
Description: pg_settings.conf