Received: from localhost (unknown [200.46.204.183]) by developer.postgresql.org (Postfix) with ESMTP id D15ED2E0042 for ; Thu, 24 Apr 2008 06:47:42 -0300 (ADT) Received: from developer.postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 60467-09 for ; Thu, 24 Apr 2008 06:47:40 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from dc.baikal.ru (dc.baikal.ru [212.176.3.237]) by developer.postgresql.org (Postfix) with ESMTP id 7D5672E003D for ; Thu, 24 Apr 2008 06:47:39 -0300 (ADT) Received: from it319k5.dc-local (it319k5.dc-local [10.0.4.75]) (authenticated bits=0) by dc.baikal.ru (8.13.8/8.13.8) with ESMTP id m3O9laoK028741; Thu, 24 Apr 2008 18:47:36 +0900 Message-ID: <48105739.30900@dc.baikal.ru> Date: Thu, 24 Apr 2008 18:47:37 +0900 From: Vlad Arkhipov User-Agent: Thunderbird 2.0.0.0 (X11/20070326) MIME-Version: 1.0 To: Albe Laurenz CC: pgsql-performance@postgresql.org Subject: Re: Optimizer's issue References: <480FDF0E.3000909@dc.baikal.ru> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Virus-Scanned: ClamAV version 0.93, clamav-milter version 0.93 on dc.baikal.ru X-Virus-Status: Clean X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests=AWL=0.000 X-Spam-Level: X-Archive-Number: 200804/354 X-Sequence-Number: 29847 Albe Laurenz пишет: > Vlad Arkhipov wrote: > >> I found strange issue in very simple query. >> > > You forgot to mention what your problem is. > > Yours, > Laurenz Albe > It was written below in my first post: "These queries are part of big query and optimizer put them on the leaf of query tree, so rows miscount causes a real problem. " actual rows count for the first query is 294, estimate - 11; for the second -- 283 and 0. Postgres tries to use nested loops when it should use merge/hash join and vice versa.