Re: PostgreSQL does not choose my indexes well

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: PostgreSQL does not choose my indexes well
Дата
Msg-id 4315.1587655779@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: PostgreSQL does not choose my indexes well  ("David G. Johnston" <david.g.johnston@gmail.com>)
Ответы Re: PostgreSQL does not choose my indexes well
Re: PostgreSQL does not choose my indexes well
Re: PostgreSQL does not choose my indexes well
Список pgsql-performance
"David G. Johnston" <david.g.johnston@gmail.com> writes:
> On Thursday, April 23, 2020, Thomas Kellerer <shammat@gmx.net> wrote:
>> Plus: scanning idx_tabla_entidad is more efficient because that index is
>> smaller.

> Really?  The absence of 33 million rows in the partial index seems like it
> would compensate fully and then some for the extra included columns.

On the other hand, an indexscan is likely to end up being effectively
random-access rather than the purely sequential access involved in
a seqscan.  (If the index was built recently, then it might not be
so bad --- but the planner doesn't know that, so it assumes that the
index leaf pages are laid out pretty randomly.)  Moreover, unless the
table is mostly marked all-visible, there will be another pile of
randomized accesses into the heap to validate visibility of the index
entries.

Bottom line is that this choice is not nearly as open-and-shut as
the OP seems to think.  In fact, it's fairly likely that this is a
badly designed index, not a well-designed one that the planner is
unaccountably failing to use.  Both covering indexes and partial
indexes are easily-misused features that can make performance worse
not better.

            regards, tom lane



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

Предыдущее
От: "David G. Johnston"
Дата:
Сообщение: Re: PostgreSQL does not choose my indexes well
Следующее
От: Michael Lewis
Дата:
Сообщение: Re: PostgreSQL does not choose my indexes well