Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id 3FDA5632A69 for ; Wed, 7 Jul 2010 05:58:41 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.29]) (amavisd-maia, port 10024) with ESMTP id 30869-09 for ; Wed, 7 Jul 2010 08:58:34 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-ww0-f50.google.com (mail-ww0-f50.google.com [74.125.82.50]) by mail.postgresql.org (Postfix) with ESMTP id BE27463296A for ; Wed, 7 Jul 2010 05:58:33 -0300 (ADT) Received: by wwi18 with SMTP id 18so782026wwi.19 for ; Wed, 07 Jul 2010 01:58:31 -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:cc:subject:references:in-reply-to :content-type:content-transfer-encoding; bh=Mpu1sdHsr+YkWyZZ5URU5Lft7CoR2mz/aqRCWamjoRY=; b=uhQQC+mOjBJdTiCCEbNHQFnkAIrAdCsDxKwSNtfwYMG1zB0CXJwMpmvoCQLvqv+M0+ dRQFbZDrjvPVcNElrAmxAm2ZCV6FRBZtJy8ghqrBfOnq53kKl2DHsmAwZXeLeHj4d7vx 720fPI4deZXpmaKoK2EJZmmmg6hM3d43Kt3W4= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; b=cPRZ5lax8JqQu6Ib8y9n/UTzIaWGDd5hNIpoqm/TDhCzILzsjYQ87Mx8dONDRz42CK 713FE/lOgcm2sw93NMcy38tmXFB1XVwXPhERxsZalIw4h0GHcNLWhZ9Fnc5Y9qDxAiHL hxthuHDYizSX84/fuCFU3R/4NyE3bTTC6Rwuk= Received: by 10.213.15.82 with SMTP id j18mr5503870eba.82.1278493111240; Wed, 07 Jul 2010 01:58:31 -0700 (PDT) Received: from [0.0.0.0] (5357DA75.cable.casema.nl [83.87.218.117]) by mx.google.com with ESMTPS id v8sm59435574eeh.14.2010.07.07.01.58.30 (version=TLSv1/SSLv3 cipher=RC4-MD5); Wed, 07 Jul 2010 01:58:30 -0700 (PDT) Message-ID: <4C3441EB.8010405@gmail.com> Date: Wed, 07 Jul 2010 10:59:23 +0200 From: Yeb Havinga User-Agent: Thunderbird 2.0.0.24 (Windows/20100228) MIME-Version: 1.0 To: "JOUANIN Nicolas (44)" CC: 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: <4C343F31.2050402@dgfip.finances.gouv.fr> 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.5 tagged_above=-10 required=5 tests=BAYES_05=-0.5, RCVD_IN_DNSWL_NONE=-0.0001 X-Spam-Level: X-Archive-Number: 201007/81 X-Sequence-Number: 39470 JOUANIN Nicolas (44) wrote: > > The strange thing is that this morning explain analyze now gives a > much better duration : > > There were no modification made on the database except a restart > yesterday evening and a vacuumdb --analyse ran at night. If the earlier bad query was run on a fresh imported database that was not ANALYZEd, it would explain the different and likely bad plan. If you want to know for sure this is the cause, instead of e.g. faulty hardware, you could verify redoing the import + query without analyze. regards, Yeb Havinga