Received: from magus.postgresql.org (magus.postgresql.org [87.238.57.229]) by mail.postgresql.org (Postfix) with ESMTP id 0A3997E4442 for ; Fri, 22 Jun 2012 12:13:13 -0300 (ADT) Received: from gwmta.wicourts.gov ([165.219.244.99] helo=gw.wicourts.gov) by magus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1Si5Xq-0006p5-6r for pgsql-bugs@postgresql.org; Fri, 22 Jun 2012 15:13:13 +0000 Received: from Courts-MTA by gw.wicourts.gov with Novell_GroupWise; Fri, 22 Jun 2012 10:12:55 -0500 Message-Id: <4FE4452402000025000489C7@gw.wicourts.gov> X-Mailer: Novell GroupWise Internet Agent 8.0.2 Date: Fri, 22 Jun 2012 10:12:52 -0500 From: "Kevin Grittner" To: , Subject: Re: BUG #6702: SELECT Query on INDEX References: In-Reply-To: Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Content-Disposition: inline X-Pg-Spam-Score: -4.2 (----) X-Archive-Number: 201206/196 X-Sequence-Number: 33423 wrote: > I created a Index in postgres.Now i want to fire select query in > this Index and check data. > > Please tell me how to perform this??? This is not a bug. Please post any follow-ups or similar questions to pgsql-general or pgsql-novice; or if it is a performance question, try pgsql-performance. To answer the question, as long as we're here, PostgreSQL uses a cost-based optimizer -- so it will consider using the index on any queries for the table which reference indexed columns. On a tiny table (a few thousand rows or less), or if you are selecting more than about 10% of the rows from the table, it is unlikely to use the index because a simple scan of the heap is almost always faster. Load up the tables with a lot of data and select for equality against an indexed column using a value present in a small number of rows, and you are likely to see the index used. If you think the optimizer is not choosing the fastest plan, please read this page: http://wiki.postgresql.org/wiki/SlowQueryQuestions -Kevin