From: Kevin Grittner <Kevin.Grittner@wicourts.gov>
To: alokrawat0212@gmail.com
To: pgsql-bugs@postgresql.org
Subject: Re: BUG #6702: SELECT Query on INDEX
Date: Fri, 22 Jun 2012 10:12:52 -0500
Message-ID: <4FE4452402000025000489C7@gw.wicourts.gov> (raw)
In-Reply-To: <E1ShsXO-0000qi-Le@wrigleys.postgresql.org>
References: <E1ShsXO-0000qi-Le@wrigleys.postgresql.org>
<alokrawat0212@gmail.com> 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-bugs@postgresql.org
Cc: Kevin.Grittner@wicourts.gov, alokrawat0212@gmail.com
Subject: Re: BUG #6702: SELECT Query on INDEX
In-Reply-To: <4FE4452402000025000489C7@gw.wicourts.gov>
References: <E1ShsXO-0000qi-Le@wrigleys.postgresql.org> <4FE4452402000025000489C7@gw.wicourts.gov>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox