Received: from maia.hub.org (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id 428E5634E46 for ; Sun, 11 Apr 2010 19:41:33 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.208.211]) (amavisd-maia, port 10024) with ESMTP id 68310-01 for ; Sun, 11 Apr 2010 22:41:16 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-bw0-f216.google.com (mail-bw0-f216.google.com [209.85.218.216]) by mail.postgresql.org (Postfix) with ESMTP id 5D47C6337CE for ; Sun, 11 Apr 2010 19:41:22 -0300 (ADT) Received: by bwz8 with SMTP id 8so2435619bwz.3 for ; Sun, 11 Apr 2010 15:41:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from :user-agent:mime-version:to:subject:references:in-reply-to :content-type:content-transfer-encoding; bh=eAle/XnRcX725nzfPRxIeyZjio8UlZZj+C4/czSsLHo=; b=x4nbb9O9zdJCBNQFATXfApLoTz2ubJC2nOu9jAcdxoEuJkOxtflqPHv9QHrfcUpAnI gYWVZh8COeZhD9j0sshjZROwIRa4TCNY4Nbx0IcvrjqHXCAYDWjwx+QtSyF/LJ/YBVrp CWaB7HTKUz7EHzhMawlrT717y228Eni084Rzg= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:content-type:content-transfer-encoding; b=WmJW67uhXrFdlmwCxzJ53WNFeUs2ei8QmrdUXtw0S66i1VsQMRGfVHrcS86mMKDwV4 rZ9pQzZHS8SweZOhy+NxTJZ6Ti/2pwQqwaENsC7x4RvnGFIoTXorZrC3QgScSi8b8Kjb lB3AZFn/W4tDeSqgyYEoAPpxM1MBd4/TkH7BQ= Received: by 10.204.141.133 with SMTP id m5mr3652433bku.91.1271025680602; Sun, 11 Apr 2010 15:41:20 -0700 (PDT) Received: from [192.168.1.20] (HSI-KBW-082-212-034-242.hsi.kabelbw.de [82.212.34.242]) by mx.google.com with ESMTPS id 16sm1471513bwz.9.2010.04.11.15.41.19 (version=SSLv3 cipher=RC4-MD5); Sun, 11 Apr 2010 15:41:20 -0700 (PDT) Message-ID: <4BC2500F.5000306@gmail.com> Date: Mon, 12 Apr 2010 00:41:19 +0200 From: Corin User-Agent: Thunderbird 2.0.0.24 (X11/20100317) MIME-Version: 1.0 To: Scott Marlowe , pgsql-performance@postgresql.org Subject: Re: planer chooses very bad plan References: <4BC23B3E.5020500@gmail.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-0.681 tagged_above=-10 required=5 tests=AWL=-0.681 X-Spam-Level: X-Archive-Number: 201004/143 X-Sequence-Number: 38393 On 11.04.2010 23:18, Scott Marlowe wrote: > In both instances your number of rows estimated is WAY higher than the > actual number of rows returned. Perhaps if you increased > default_statistics_target to 100, 200, 500 etc. re-analyzed, and then > reun explain analyze again. > > Also increasing work_mem might encourage the bitmap index scans to occur. > Increasing the statistics >= 500 indeed helped a lot and causes the planner to choose a good plan. :) I'm now thinking about increasing the default_statistics_target of the whole server from the default (100) to 1000, because I have many tables with similar data. As the size of the table index seems not change at all, I wonder how much additional storage is needed? I only care about runtime performance: are inserts/updates affected by this change? Or is only analyze affected (only run once during the night)? Thanks, Corin