Re: Incorrect assumptions with low LIMITs

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Incorrect assumptions with low LIMITs
Дата
Msg-id 21171.1331932298@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Incorrect assumptions with low LIMITs  (Simon Riggs <simon@2ndQuadrant.com>)
Ответы Re: Incorrect assumptions with low LIMITs
Список pgsql-hackers
Simon Riggs <simon@2ndQuadrant.com> writes:
> 2. We assume that if values do exist that they have rows uniformly
> distributed across the whole table like rungs on a ladder.

Well, yeah.  That's sometimes wrong, but not always.  In the absence
of evidence to the contrary, I think it's a better assumption than
most others.

> Any time we apply a LIMIT clause to a plan with a SeqScan or
> unqualified IndexScan, we shouldn't assume the scan will do less than
> say 10% of the table.

This is a horrid idea, because it will stop the planner from using
fast-start plans in many situations where they are wins.

> Other ideas welcome.

You are not the first person to have run into this type of problem.
If it were easily solved by some minor hack, we would have done that
long since.  The problem is to not throw the baby out with the
bathwater.

I can see an argument for downgrading the assumed effectiveness of
restrictions that are applied as qpquals (ie, not indexquals), but
the LIMIT node coster doesn't have easy access to the information
needed for that, especially not in situations more complicated than
a single-table scan.
        regards, tom lane


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

Предыдущее
От: Andres Freund
Дата:
Сообщение: Re: Command Triggers, patch v11
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Command Triggers, patch v11