X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id DF9D552A60 for ; Wed, 11 May 2005 17:59:46 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 89162-04 for ; Wed, 11 May 2005 20:59:45 +0000 (GMT) Received: from soufre.accelance.net (soufre.accelance.net [213.162.48.15]) by svr1.postgresql.org (Postfix) with ESMTP id 00E5D53E59 for ; Wed, 11 May 2005 17:59:43 -0300 (ADT) Received: from [82.122.171.172] (ALyon-252-1-61-172.w82-122.abo.wanadoo.fr [82.122.171.172]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by soufre.accelance.net (Postfix) with ESMTP id E5BA85D38; Wed, 11 May 2005 22:59:41 +0200 (CEST) Message-ID: <4282723C.5080903@smet.org> Date: Wed, 11 May 2005 22:59:40 +0200 From: Guillaume Smet User-Agent: Mozilla Thunderbird 1.0.2-1.3.2 (X11/20050324) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Tom Lane Cc: josh@agliodbs.com, pgsql-performance@postgresql.org Subject: Re: Bad plan after vacuum analyze References: <42823F94.8050009@smet.org> <200505111110.15983.josh@agliodbs.com> <13964.1115837926@sss.pgh.pa.us> <42825DBB.7000703@smet.org> <14301.1115840296@sss.pgh.pa.us> <4282638E.2020307@smet.org> <17017.1115843555@sss.pgh.pa.us> In-Reply-To: <17017.1115843555@sss.pgh.pa.us> X-Enigmail-Version: 0.89.6.0 X-Enigmail-Supports: pgp-inline, pgp-mime Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= X-Spam-Level: X-Archive-Number: 200505/221 X-Sequence-Number: 12385 Josh, Tom, Thanks for your explanations. > In the meantime it seems like the quickest answer for Guillaume might > be to try to avoid keeping any NULLs in parent_application_id. I can't do that as the majority of the applications don't have any parent one. Moreover, we use a third party application and we cannot modify all its internals. Anyway, I tried to work on the statistics as you told me and here are the results: ccm_perf=# ALTER TABLE acs_objects ALTER COLUMN object_id SET STATISTICS 30; ALTER TABLE ccm_perf=# ANALYZE acs_objects; ANALYZE ccm_perf=# \i query_section.sql ... correct plan ... Total runtime: 0.555 ms So I think I will use this solution for the moment. Thanks a lot for your help. Regards -- Guillaume