Re: seq vs index scan in join query

Поиск
Список
Период
Сортировка
От Andres Freund
Тема Re: seq vs index scan in join query
Дата
Msg-id 20171129174640.o7q2ge4f3lk25cmo@alap3.anarazel.de
обсуждение исходный текст
Ответ на Re: seq vs index scan in join query  (Laurenz Albe <laurenz.albe@cybertec.at>)
Ответы Re: seq vs index scan in join query
Список pgsql-general
On 2017-11-29 18:17:18 +0100, Laurenz Albe wrote:
> That is because the execution with the sequential scan touched
> 26492  + 80492 = 106984 blocks, while the second execution touched
> 311301 + 48510 = 359811 blocks, more than three times as many.

That's not necessarily said. What those count are buffer *accesses*,
*not* the number of distinct blocks accessed. You'll very commonly have
more buffer accesses in indexscans but still fewer total reads because a
lot of those accesses will be reads previously done in the same
scan. Just imagine a scan of an index with a leaf page pointing to 100
tuples of the same value - that'd result in at least a 100 buffer
accesses, but it'd be highly likely that they'll be in cache.

Greetings,

Andres Freund


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

Предыдущее
От: Laurenz Albe
Дата:
Сообщение: Re: seq vs index scan in join query
Следующее
От: Rory Campbell-Lange
Дата:
Сообщение: Re: large numbers of inserts out of memory strategy