Received: from localhost (maia-3.hub.org [200.46.204.184]) by postgresql.org (Postfix) with ESMTP id 9887E9FB51A for ; Thu, 5 Jul 2007 15:05:55 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.184]) (amavisd-maia, port 10024) with ESMTP id 80684-05 for ; Thu, 5 Jul 2007 15:05:39 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from lists.commandprompt.com (host-254.commandprompt.net [207.173.203.254]) by postgresql.org (Postfix) with ESMTP id 52D2A9FC041 for ; Thu, 5 Jul 2007 15:05:50 -0300 (ADT) Received: from perhan.alvh.no-ip.org (201-221-218-82.bk12-dsl.surnet.cl [201.221.218.82]) (authenticated bits=0) by lists.commandprompt.com (8.13.7/8.13.6) with ESMTP id l65I5olw015279; Thu, 5 Jul 2007 11:05:51 -0700 Received: by perhan.alvh.no-ip.org (Postfix, from userid 1000) id 2B73847C44; Thu, 5 Jul 2007 14:05:47 -0400 (CLT) Date: Thu, 5 Jul 2007 14:05:47 -0400 From: Alvaro Herrera To: smiley2211 Cc: pgsql-performance@postgresql.org Subject: Re: Query is taking 5 HOURS to Complete on 8.1 version Message-ID: <20070705180547.GN5500@alvh.no-ip.org> References: <11416966.post@talk.nabble.com> <11451397.post@talk.nabble.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <11451397.post@talk.nabble.com> User-Agent: Mutt/1.5.13 (2006-08-11) X-Virus-Scanned: ClamAV 0.90.3/3604/Thu Jul 5 03:33:34 2007 on projects.commandprompt.com X-Virus-Status: Clean X-Greylist: Sender succeded SMTP AUTH authentication, not delayed by milter-greylist-1.6 (lists.commandprompt.com [192.168.2.159]); Thu, 05 Jul 2007 11:05:51 -0700 (PDT) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200707/38 X-Sequence-Number: 25722 smiley2211 wrote: > > Hello all, > > I've made the changes to view to use UNION ALL and the where NOT IN > suggestions...the query now takes a little under 3 hours instead of 5 -- > here is the EXPLAIN ANALYZE: It seems you have disabled nested loops --- why? Try turning them back on and let us see the EXPLAIN ANALYZE again. It would be extremely helpful if you saved it in a file and attached it separately so that the indentation and whitespace is not mangled by your email system. It would be a lot more readable that way. -- Alvaro Herrera http://www.CommandPrompt.com/ PostgreSQL Replication, Consulting, Custom Development, 24x7 support