Received: from localhost (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id 4B9C364FCFF for ; Fri, 14 Nov 2008 13:14:41 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 33928-02 for ; Fri, 14 Nov 2008 13:14:34 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from pih-relay04.plus.net (pih-relay04.plus.net [212.159.14.17]) by mail.postgresql.org (Postfix) with ESMTP id 9463065013C for ; Fri, 14 Nov 2008 13:14:33 -0400 (AST) Received: from [84.51.143.99] (helo=server3.office.archonet.com) by pih-relay04.plus.net with esmtp (Exim) id 1L12FS-0003J4-1T; Fri, 14 Nov 2008 17:14:22 +0000 Received: from [192.168.1.36] (dell36.office.archonet.com [192.168.1.36]) by server3.office.archonet.com (Postfix) with ESMTP id 4075B27406F; Fri, 14 Nov 2008 17:14:17 +0000 (GMT) Message-ID: <491DB1E9.6030500@archonet.com> Date: Fri, 14 Nov 2008 17:14:17 +0000 From: Richard Huxton User-Agent: Thunderbird 2.0.0.17 (X11/20080914) MIME-Version: 1.0 To: Patrice Beliveau CC: pgsql-performance@postgresql.org Subject: Re: Difference in query plan References: <491DB061.4020002@avior.ca> In-Reply-To: <491DB061.4020002@avior.ca> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Plusnet-Relay: af710e0a711c212fd095261ee29d9795 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests=none X-Spam-Level: X-Archive-Number: 200811/136 X-Sequence-Number: 31867 Patrice Beliveau wrote: > Thanks, > > I'm already doing a vacuum full every night on all database, but the > REINDEX fix it and now it's working fine Are you sure it was the REINDEX? The plan was using a sequential scan. > But this raise a question > > 1) This table is cleared every night and recomputed, does this mean that > I should REINDEX every night also Looks like you should. Or drop the indexes, load the data, re-create the indexes, that can be quicker. > 2) Why this thing didn't happen in the other schema Have you re-loaded schema1 more often? It might even be the particular order that rows are loaded - a btree can become "unbalanced" sometimes. -- Richard Huxton Archonet Ltd