Re: Why the planner does not use index for a large amount of data?

Поиск
Список
Период
Сортировка
От Jim Finnerty
Тема Re: Why the planner does not use index for a large amount of data?
Дата
Msg-id 1513050964482-0.post@n3.nabble.com
обсуждение исходный текст
Ответ на Why the planner does not use index for a large amount of data?  (hmidi slim <hmidi.slim2@gmail.com>)
Список pgsql-general
Hi Hmidi,

    Your description omits some important information, such as whether you
defined your index to include all columns needed by the request, but the
short answer is 'yes', if you retrieve enough rows, then it will be faster
to read the entire heap instead of reading the necessary parts of the index
and all the referenced pages of the heap, in index order.  The decision is
more complex than just this in PostgreSQL due to MVCC, the visibility bits
on each page, and the alternative of doing a bitmap heap scan when the
selectivity is moderate.  The planner is designed to consider all these
factors, cost them, and choose a minimum cost plan.

    If you're convinced that the planner has not picked the fastest plan,
you can either try to force the plan by setting the enable_* guc variables,
or you can use the pg_hint_plan extension (which sets the enable_* variables
on your behalf), to get the plan you want, and then measure the performance
of the query with each alternative.

    /Jim F



--
Sent from: http://www.postgresql-archive.org/PostgreSQL-general-f1843780.html


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

Предыдущее
От: Sam Gendler
Дата:
Сообщение: Re: How to know if a database has changed
Следующее
От: "Tsunakawa, Takayuki"
Дата:
Сообщение: RE: Is it possible to sort strings in EBCDIC order in PostgreSQLserver?