Re: Research/Implementation of Nested Loop Join optimization

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Research/Implementation of Nested Loop Join optimization
Дата
Msg-id 4160.1217032003@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Research/Implementation of Nested Loop Join optimization  (Gregory Stark <stark@enterprisedb.com>)
Ответы Re: Research/Implementation of Nested Loop Join optimization  (Alvaro Herrera <alvherre@commandprompt.com>)
Re: Research/Implementation of Nested Loop Join optimization  (Ron Mayer <rm_pg@cheapcomplexdevices.com>)
Re: Research/Implementation of Nested Loop Join optimization  (Gregory Stark <stark@enterprisedb.com>)
Список pgsql-hackers
Gregory Stark <stark@enterprisedb.com> writes:
> "Manoel Henrique" <mhenriquesgbd@gmail.com> writes:
>> Yes, I'm relying on the assumption that backwards scan has the same cost as
>> forward scan, why shouldn't it?

> Because hard drives only spin one direction

Good joke, but to be serious: we expect that forward scans will result
in the kernel doing read-ahead, which will allow overlapping of
CPU work to process one page with the I/O to bring in the next page.
A backwards scan will get no such overlapping and thus be up to 2X
slower, unless the kernel is smart enough to do read-ahead for
descending-order read requests.  Which seems not too probable.  A fairly
typical kernel behavior is that read-ahead is triggered by successive
read() requests without any intervening seek(), and this is impossible
for a backward scan.

(Yes, we do optimize out the seek calls in a forward scan.  IIRC it's
done in fd.c.)
        regards, tom lane


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

Предыдущее
От: Alvaro Herrera
Дата:
Сообщение: Re: Research/Implementation of Nested Loop Join optimization
Следующее
От: daveg
Дата:
Сообщение: Re: Adding WHERE clause to pg_dump