Re: PostgreSQL 12.3 slow index scan chosen

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: PostgreSQL 12.3 slow index scan chosen
Дата
Msg-id 2087061.1592854782@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: PostgreSQL 12.3 slow index scan chosen  (Alvaro Herrera <alvherre@2ndquadrant.com>)
Список pgsql-performance
Alvaro Herrera <alvherre@2ndquadrant.com> writes:
> On 2020-Jun-20, Tom Lane wrote:
>> You said you'd increased the stats target for
>> objectcustomfieldvalues.objectid, but maybe the real problem is needing
>> to increase the targets for content and largecontent, in hopes of driving
>> down the estimate for how many rows will pass this filter condition.

> ... but those on content and largecontent are unanchored conditions --
> are we still able to do any cardinality analysis using those?

Yes, if the stats histogram is large enough we'll apply it by just
evaluating the query operator verbatim on each entry (thereby assuming
that the histogram is usable as a random sample).  And we apply the
query condition on each MCV entry too (no assumptions needed there).
The unanchored LIKE conditions could not be used as btree indexquals,
but that has little to do with selectivity estimation.

Since we bound those things at 10K entries, the histogram alone can't give
better than 0.01% estimation precision, which in itself wouldn't have
done the job for the OP -- he needed a couple more places of accuracy
than that.  I surmise that he had a nontrivial MCV population as well,
since he found that raising the stats target did eventually drive down
the estimate far enough to fix the problem.

            regards, tom lane



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

Предыдущее
От: Kenneth Marshall
Дата:
Сообщение: Re: PostgreSQL 12.3 slow index scan chosen
Следующее
От: Nikhil Shetty
Дата:
Сообщение: Recommended value for pg_test_fsync