X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 6919FD1B171 for ; Thu, 13 May 2004 12:01:35 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 25390-08 for ; Thu, 13 May 2004 12:01:15 -0300 (ADT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id 8ED63D1B16F for ; Thu, 13 May 2004 12:01:14 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.11/8.12.11) with ESMTP id i4DF10xB008905; Thu, 13 May 2004 11:01:00 -0400 (EDT) To: "Fabio Panizzutti" Cc: "'Shridhar Daithankar'" , pgsql-performance@postgresql.org Subject: Re: R: Query plan on identical tables differs . Why ? In-reply-to: <006301c438f3$6ca33460$3c02020a@ufficio> References: <006301c438f3$6ca33460$3c02020a@ufficio> Comments: In-reply-to "Fabio Panizzutti" message dated "Thu, 13 May 2004 16:06:01 +0200" Date: Thu, 13 May 2004 11:01:00 -0400 Message-ID: <8904.1084460460@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200405/124 X-Sequence-Number: 6955 "Fabio Panizzutti" writes: > I don't understand why the planner chose a different query plan on > identical tables with same indexes . Different data statistics; not to mention different table sizes (the cost equations are not linear). Have you ANALYZEd (or VACUUM ANALYZEd) both tables recently? If the stats are up to date but still not doing the right thing, you might try increasing the statistics target for the larger table's tag_id column. See ALTER TABLE SET STATISTICS. regards, tom lane