Received: from localhost (maia-1.hub.org [200.46.204.191]) by postgresql.org (Postfix) with ESMTP id 9FB1B9FBAB1 for ; Tue, 29 May 2007 22:38:43 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.191]) (amavisd-maia, port 10024) with ESMTP id 48626-06 for ; Tue, 29 May 2007 22:38:36 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from mtao03.charter.net (mtao03.charter.net [209.225.8.188]) by postgresql.org (Postfix) with ESMTP id 7C72E9FB948 for ; Tue, 29 May 2007 22:38:36 -0300 (ADT) Received: from aa02.charter.net ([10.20.200.154]) by mtao03.charter.net (InterMail vM.7.08.02.00 201-2186-121-20061213) with ESMTP id <20070530013831.OEHH1525.mtao03.charter.net@aa02.charter.net>; Tue, 29 May 2007 21:38:31 -0400 Received: from [10.0.1.3] (really [66.188.164.45]) by aa02.charter.net with ESMTP id <20070530013831.YTJK16669.aa02.charter.net@[10.0.1.3]>; Tue, 29 May 2007 21:38:31 -0400 In-Reply-To: References: Mime-Version: 1.0 (Apple Message framework v752.2) Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: Cc: Content-Transfer-Encoding: 7bit From: Michael Glaesemann Subject: Re: Very slow left outer join Date: Tue, 29 May 2007 20:38:24 -0500 To: "Tyrrill, Ed" X-Mailer: Apple Mail (2.752.2) X-Chzlrs: 0 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200705/594 X-Sequence-Number: 24984 On May 29, 2007, at 19:16 , Tyrrill, Ed wrote: > ----- > Hash Join (cost=361299.50..1054312.92 rows=34805 width=8) (actual > time=1446.861..368723.597 rows=2789 loops=1) > Hash Cond: ("outer".record_id = "inner".record_id) > -> Seq Scan on backupobjects (cost=0.00..429929.79 rows=13136779 > width=8) (actual time=5.165..359168.216 rows=13136779 loops=1) > -> Hash (cost=360207.21..360207.21 rows=436915 width=8) (actual > time=820.979..820.979 rows=2789 loops=1) > -> Bitmap Heap Scan on backup_location > (cost=3831.20..360207.21 rows=436915 width=8) (actual > time=797.463..818.269 rows=2789 loops=1) > Recheck Cond: (backup_id = 1071) > -> Bitmap Index Scan on backup_location_bid > (cost=0.00..3831.20 rows=436915 width=0) (actual time=59.592..59.592 > rows=2789 loops=1) Off the cuff, when was the last time you vacuumed or ran ANALYZE? Your row estimates look off by a couple orders of magnitude. With up- to-date statistics the planner might do a better job. As for any other improvements, I'll leave that to those that know more than I. :) Michael Glaesemann grzm seespotcode net