Re: Using index name in select Query

Поиск
Список
Период
Сортировка
От Luca Ferrari
Тема Re: Using index name in select Query
Дата
Msg-id CAKoxK+6DD82qYGoc8UsbJ-S-=bsNSj7rMqAg305vjc1sGO65+g@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Using index name in select Query  ("naman.iitb" <naman.bbps@gmail.com>)
Список pgsql-novice
On Sat, Oct 19, 2013 at 4:28 PM, naman.iitb <naman.bbps@gmail.com> wrote:

> Now my requirement is if i know the index name i.e. index_abcd then is there
> a way by which i can use it in the select query so that i can be sure that
> optimizer will pick the index specified(i.e index_abcd) and no other.
>

What you want is called "query hints" and PostgreSQL, as pointed out
by others, do not support it by policy. The idea is that the planner
knows better than you what to do with your query. What you believe is
the better index today could be the bad index tomorrow, or even a few
seconds after you just told your boss how smart you have  been
designing such index, and that is strictly tied to the workload of
your cluster.
The only way to force PostgreSQL using your own index is to disable
all other access methods (e.g., enabled_seqscan = off) and to make all
other indexes not available (via catalogs). But this will impact all
your cluster.

Any chance this is an homework?

Luca


В списке pgsql-novice по дате отправления:

Предыдущее
От: David Johnston
Дата:
Сообщение: Re: Using index name in select Query
Следующее
От: James David Smith
Дата:
Сообщение: COUNT and GROUP BY performing strangely