pgsql: Clamp indexscan filter condition cost estimate to be not less th

Поиск
Список
Период
Сортировка
От Tom Lane
Тема pgsql: Clamp indexscan filter condition cost estimate to be not less th
Дата
Msg-id E1SI7qz-0005qg-CJ@gemulon.postgresql.org
обсуждение исходный текст
Список pgsql-committers
Clamp indexscan filter condition cost estimate to be not less than zero.

cost_index tries to estimate the per-tuple costs of evaluating filter
conditions (a/k/a qpquals) by subtracting the estimated cost of the
indexqual conditions from that of the baserestrictinfo conditions.  This is
correct so long as the indexquals list is a subset of the baserestrictinfo
list.  However, in the presence of derived indexable conditions it's
completely wrong, leading to bogus or even negative scan cost estimates,
as seen for example in bug #6579 from Istvan Endredy.  In practice the
problem isn't severe except in the specific case of a LIKE optimization on
a functional index containing a very expensive function.

A proper fix for this might change cost estimates by more than people would
like for stable branches, so in the back branches let's just clamp the cost
difference to be not less than zero.  That will at least prevent completely
insane behavior, while not changing the results normally.

Branch
------
REL8_3_STABLE

Details
-------
http://git.postgresql.org/pg/commitdiff/67a48385b5671a815cd355bbf7375e2a3e594ba9

Modified Files
--------------
src/backend/optimizer/path/costsize.c |   11 ++++++++++-
1 files changed, 10 insertions(+), 1 deletions(-)


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

Предыдущее
От: Tom Lane
Дата:
Сообщение: pgsql: Fix cost estimation for indexscan filter conditions.
Следующее
От: Tom Lane
Дата:
Сообщение: pgsql: Clamp indexscan filter condition cost estimate to be not less th