X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 43C5FD1B38E for ; Tue, 3 Aug 2004 12:00:16 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 38581-06 for ; Tue, 3 Aug 2004 14:59:42 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id 647AED1B37F for ; Tue, 3 Aug 2004 11:59:22 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.11/8.12.11) with ESMTP id i73ExHPD023046; Tue, 3 Aug 2004 10:59:17 -0400 (EDT) To: "Merlin Moncure" Cc: "Marius Andreiana" , pgsql-performance@postgresql.org Subject: Re: NOT IN query takes forever In-reply-to: <6EE64EF3AB31D5448D0007DD34EEB34101AF1A@Herge.rcsinc.local> References: <6EE64EF3AB31D5448D0007DD34EEB34101AF1A@Herge.rcsinc.local> Comments: In-reply-to "Merlin Moncure" message dated "Tue, 03 Aug 2004 08:05:23 -0400" Date: Tue, 03 Aug 2004 10:59:17 -0400 Message-ID: <23045.1091545157@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=1.1 tagged_above=0.0 required=5.0 tests=NO_DNS_FOR_FROM X-Spam-Level: * X-Archive-Number: 200408/31 X-Sequence-Number: 7667 "Merlin Moncure" writes: > Try bumping up shared buffers some and sort mem as much as you safely > can. sort_mem is probably the issue here. The only reasonable way to do NOT IN is with a hash table, and the default setting of sort_mem is probably too small to support a 137042-element table. regards, tom lane