X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 2DA7FDADB4 for ; Tue, 25 Oct 2005 10:38:34 -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 31260-02 for ; Tue, 25 Oct 2005 13:38:30 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id DB38BDADA4 for ; Tue, 25 Oct 2005 10:38:31 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j9PDcZFZ013280; Tue, 25 Oct 2005 09:38:35 -0400 (EDT) To: Kishore B Cc: pgsql-performance@postgresql.org Subject: Re: Why Index is not working on date columns. In-reply-to: <42567e060510250147j582ce648p3ceef8e4376975be@mail.gmail.com> References: <42567e060510250147j582ce648p3ceef8e4376975be@mail.gmail.com> Comments: In-reply-to Kishore B message dated "Tue, 25 Oct 2005 14:17:57 +0530" Date: Tue, 25 Oct 2005 09:38:35 -0400 Message-ID: <13279.1130247515@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.006 required=5 tests=[AWL=0.006] X-Spam-Level: X-Archive-Number: 200510/356 X-Sequence-Number: 15124 Kishore B writes: > Can you guys please take a look at the following query and let me know why > the index is not considered in the plan? "Considered" and "used" are two different things. The two examples you give have the same estimated cost (within two decimal places) so the planner sees no particular reason to choose one over the other. I surmise that you are testing on toy tables and extrapolating to what will happen on larger tables. This is an unjustified assumption. Create a realistic test data set, ANALYZE it, and then see if the planner chooses indexes you like. regards, tom lane