Here is the explain plan of the new query (same as original but with changes to the Date subquery to use ::date instead of to_char to truncate the time portion), when it is run after doing these 2 sets first: set work_mem='8MB'; set enable_nestloop = false; explain plan (8.4): http://explain.depesz.com/s/tw8 thanks again for the help. Julie -----Original Message----- From: tv@xxxxxxxx [mailto:tv@xxxxxxxx] Sent: Monday, March 21, 2011 11:33 AM To: Davenport, Julie Cc: Merlin Moncure; Tomas Vondra; pgsql-general@xxxxxxxxxxxxxx Subject: RE: query taking much longer since Postgres 8.4 upgrade > Incredible! Setting enable_nestloop off temporarily for the run of this > script made it run in less than a minute (had been running in 10 or 11 > minutes). I think you have found a solution for many of my slow running > scripts that use these same type of joins. Thanks again. > Julie Nice. Can you post EXPLAIN ANALYZE again, so that we can see why this plan was evaluated as as more expensive before disabling nested loops? regards Tomas -- Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general