Received: from localhost (maia-3.hub.org [200.46.204.184]) by postgresql.org (Postfix) with ESMTP id 779479FBF3C for ; Wed, 11 Jul 2007 17:35:38 -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 80018-03 for ; Wed, 11 Jul 2007 17:35:29 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id 74EF19FBF55 for ; Wed, 11 Jul 2007 17:35:35 -0300 (ADT) 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 l6BKZWYO002394; Wed, 11 Jul 2007 16:35:32 -0400 (EDT) To: Marc Cousin cc: pgsql-performance@postgresql.org Subject: Re: Weird row estimate In-reply-to: <200707111728.43416.mcousin@sigma.fr> References: <200707111728.43416.mcousin@sigma.fr> Comments: In-reply-to Marc Cousin message dated "Wed, 11 Jul 2007 17:28:43 +0200" Date: Wed, 11 Jul 2007 16:35:31 -0400 Message-ID: <2393.1184186131@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200707/123 X-Sequence-Number: 25807 Marc Cousin writes: > Nevertheless, shouldn't the third estimate be smaller or equal to the sum of the two others ? The planner's estimation for subplan conditions is pretty primitive compared to joinable conditions. When you add the OR, it's no longer possible to treat the IN like a join, and everything gets an order of magnitude dumber :-( It might be worth trying this as a UNION of the two simple queries. regards, tom lane