Received: from localhost (unknown [200.46.204.191]) by postgresql.org (Postfix) with ESMTP id A50A82E33FC for ; Wed, 12 Dec 2007 00:36:00 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.191]) (amavisd-maia, port 10024) with ESMTP id 59308-10 for ; Wed, 12 Dec 2007 00:35:58 -0400 (AST) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id 0D6542E33F4 for ; Wed, 12 Dec 2007 00:35:57 -0400 (AST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.1/8.14.1) with ESMTP id lBC4ZvEI011807; Tue, 11 Dec 2007 23:35:57 -0500 (EST) To: Gerry Reno cc: pgsql-sql@postgresql.org Subject: Re: join on three tables is slow In-reply-to: <475ED469.5080906@verizon.net> References: <475C96EA.6090002@verizon.net> <475CC478.7010102@Sheeky.Biz> <475E111B.6060203@verizon.net> <162867790712102200m2144573bw7447e0eff6720d55@mail.gmail.com> <475E8F6A.4030004@verizon.net> <162867790712110655o2cf99bf1n9acf6b440d726440@mail.gmail.com> <475ED469.5080906@verizon.net> Comments: In-reply-to Gerry Reno message dated "Tue, 11 Dec 2007 13:18:17 -0500" Date: Tue, 11 Dec 2007 23:35:57 -0500 Message-ID: <11806.1197434157@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200712/60 X-Sequence-Number: 29752 Gerry Reno writes: > Pavel Stehule wrote: >> there is diference in agg position. Send, please, query and explain >> analyze output. [ explain analyze output ] The rowcount estimates seem pretty far off, even for simple cases that I'd expect it to get right, eg > -> Seq Scan on res_partner_address a (cost=0.00..88.40 > rows=16 width=552) (actual time=0.851..16.131 rows=559 loops=1) > Filter: ((("type")::text = 'default'::text) OR ("type" IS > NULL)) Are the ANALYZE stats up to date for these tables? What PG version is this, anyway? regards, tom lane