Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id EC1D2632C20 for ; Wed, 7 Jul 2010 08:26:04 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.251]) (amavisd-maia, port 10024) with ESMTP id 15320-04 for ; Wed, 7 Jul 2010 11:25:55 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from mail.dgi.minefi.gouv.fr (mta5-milter-bp.dgfip.finances.gouv.fr [145.242.11.151]) by mail.postgresql.org (Postfix) with ESMTP id 43943632B87 for ; Wed, 7 Jul 2010 08:25:56 -0300 (ADT) Received: from mail.dgi.minefi.gouv.fr (localhost.localdomain [127.0.0.1]) by localhost (Postfix) with SMTP id BD972510D45; Wed, 7 Jul 2010 13:25:54 +0200 (CEST) Received: from e77a-105.eole.dgi (unknown [10.154.85.105]) by mail.dgi.minefi.gouv.fr (Postfix) with ESMTP id AF284510D00; Wed, 7 Jul 2010 13:25:54 +0200 (CEST) Received: from imesp348.bercy.cp (unknown [10.99.2.48]) by e77a-105.eole.dgi (Postfix) with ESMTP id A5E501EF0E0; Wed, 7 Jul 2010 13:25:54 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by imesp348.bercy.cp (Postfix) with ESMTP id 8942588066; Wed, 7 Jul 2010 13:25:54 +0200 (CEST) X-Virus-Scanned: amavisd-new at imesp344.oc.dgfip Received: from imesp348.bercy.cp ([127.0.0.1]) by localhost (imesp348.bercy.cp [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id qExd54iG-qyJ; Wed, 7 Jul 2010 13:25:54 +0200 (CEST) Received: from [10.156.220.90] (unknown [10.156.220.90]) by imesp348.bercy.cp (Postfix) with ESMTP id 5578A8805A; Wed, 7 Jul 2010 13:25:54 +0200 (CEST) Message-ID: <4C34648B.1010103@dgfip.finances.gouv.fr> Date: Wed, 07 Jul 2010 13:27:07 +0200 From: "JOUANIN Nicolas (44)" User-Agent: Thunderbird 2.0.0.21 (Windows/20090302) MIME-Version: 1.0 To: Guillaume Smet CC: Yeb Havinga , pgsql-performance@postgresql.org Subject: Re: Two different execution plan for the same request References: <4C3432F0.1090004@dgfip.finances.gouv.fr> <4C343A59.7050908@gmail.com> <4C343F31.2050402@dgfip.finances.gouv.fr> In-Reply-To: Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-3.486 tagged_above=-10 required=5 tests=BAYES_00=-1.9, HTML_MESSAGE=0.001, MIME_HTML_ONLY=0.723, RCVD_IN_DNSWL_MED=-2.3, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201007/84 X-Sequence-Number: 39473 It seems to work fine (same execution plan and less duration) after :
 - setting default_statistics_target to 100
 - full vacuum with analyze
 - reindexdb

Thanks.


-------- Message original --------
Sujet : Re: [PERFORM] Two different execution plan for the same request
De : Guillaume Smet <guillaume.smet@gmail.com>
Pour : JOUANIN Nicolas (44) <nicolas.jouanin@dgfip.finances.gouv.fr>
Copie à : Yeb Havinga <yebhavinga@gmail.com>, pgsql-performance@postgresql.org
Date : 07/07/2010 10:59
Hi Nicolas,

On Wed, Jul 7, 2010 at 10:47 AM, JOUANIN Nicolas (44)
<nicolas.jouanin@dgfip.finances.gouv.fr> wrote:
  
There were no modification made on the database except a restart yesterday evening and a vacuumdb --analyse ran at night.
    

It's not really surprising considering you probably kept the
default_statistics_target to 10 (it's the default in 8.3).

Consider raising it to 100 in your postgresql.conf (100 is the default
for newer versions), then reload, and run a new ANALYZE.

You might need to set it higher on specific columns if you have a lot
of data and your data distribution is weird.

And, btw, please upgrade to the latest 8.3.x.

HTH