Re: Optimizer: limit not taken into account

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Optimizer: limit not taken into account
Дата
Msg-id 24245.1147890622@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Optimizer: limit not taken into account  (Bruno Wolff III <bruno@wolff.to>)
Ответы Re: Optimizer: limit not taken into account
Список pgsql-performance
Bruno Wolff III <bruno@wolff.to> writes:
> I suspect it wasn't intended to be a full table scan. But rather a sequential
> scan until it found a matching row. If the data in the table is ordered by
> by id, this strategy may not work out well. Where as if the data is randomly
> ordered, it would be expected to find a match quickly.

Right.  You can see from the differential in the estimates for the
SeqScan and the Limit nodes that the planner is not expecting the
seqscan to run to completion, but rather to find a matching row quite
quickly.

There is not anything in there that considers whether the table's
physical order is so nonrandom that the search will take much longer
than it would given uniform distribution.  It might be possible to do
something with the correlation statistic in simple cases ...

            regards, tom lane

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

Предыдущее
От: Simon Riggs
Дата:
Сообщение: Re: Optimizer: limit not taken into account
Следующее
От: "Craig A. James"
Дата:
Сообщение: Re: Optimizer: limit not taken into account