Re: BUG #14302: SQL with LIMIT degrades performance seriously

Поиск
Список
Период
Сортировка
От Francisco Olarte
Тема Re: BUG #14302: SQL with LIMIT degrades performance seriously
Дата
Msg-id CA+bJJbyuQ2t4Q_2iaGuY9QvLnB+vDJ8C9LV7T01kASPA28jbsA@mail.gmail.com
обсуждение исходный текст
Ответ на Re: BUG #14302: SQL with LIMIT degrades performance seriously  (Kaijiang Chen <chenkaijiang@gmail.com>)
Список pgsql-bugs
On Wed, Aug 31, 2016 at 6:09 AM, Kaijiang Chen <chenkaijiang@gmail.com> wrote:
> In the sql "select * from renren.user_relations where parent_id=846346 order
> by user_id LIMIT 10;", planner can query the number of rows (with
> parent_id=846346) from the btree index, right?
> If so, planner will know that it's better to sort the rows (actually less
> than 2000) than to scan 10M rows.

mmmm, AFAIK planner does NOT query, it plans using stored statistics.
This is why some data distribution, which are a bad match for the
postgres ways of storing stats, tend to plan ( oacasionally ) badly.

Francisco Olarte.

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

Предыдущее
От: Kaijiang Chen
Дата:
Сообщение: Re: BUG #14302: SQL with LIMIT degrades performance seriously
Следующее
От: Francisco Olarte
Дата:
Сообщение: Re: BUG #14302: SQL with LIMIT degrades performance seriously