Re: Using index name in select Query

From: David Johnston <polobo(at)yahoo(dot)com>
To: pgsql-novice(at)postgresql(dot)org
Subject: Re: Using index name in select Query
Date: 2013-10-19 16:36:38
Message-ID: 1382200598027-5775148.post@n5.nabble.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Payal Singh-2 wrote
>>Postgres chooses the best, most efficient way to optimize
>> the query, and so if your index actually has the potential to improve the
>> select query at hand, postgres will choose it. If there is a better way
>> to
>> execute your query than using your index, postgres will not use it.

To be fair PostgreSQL is not infallible so if you have a situation where you
believe PostgreSQL should be using an index where it is not then such a
situation should be documented in detail and sent to the list. You can use
various "enable_" GUC to disable sequential scanning and index scanning so
that supposedly sub-optimal plans are more likely to be chosen (i.e., you
cannot absolutely disable sequential scans since in some cases brute-force
is the only valid method to execute a query). Costing parameters can also
be altered to better reflect your actual system.

In short the project's policy is to fix underlying problems (via code or
configuration) rather than implement planner hints that simply allow people
to more often shoot themselves in the foot rather than provide a permanent
solution.

David J.

--
View this message in context: http://postgresql.1045698.n5.nabble.com/Using-index-name-in-select-Query-tp5775138p5775148.html
Sent from the PostgreSQL - novice mailing list archive at Nabble.com.

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Luca Ferrari 2013-10-21 16:05:22 Re: Using index name in select Query
Previous Message Payal Singh 2013-10-19 15:46:32 Re: Using index name in select Query