Thread: Re: Number of Shared Blocks Hit

Re: Number of Shared Blocks Hit

From
Andres Freund
Date:
Hi,

On 2021-03-04 08:23:07 -0300, luis.roberto@siscobra.com.br wrote:
> While running a update, and checking EXPLAIN ANALYZE output, I found
> it strange that in the "ModifyTable" node, it shows "Shared Hit
> Blocks":351938580. If my math is correct, that amounts to more than
> 2.5TB.

Note that shared blocks hit can include repeated hits to the same
buffer. Over and over again. E.g. when you insert a new index row for
each of the rows, parts of the index will have to be traversed for each
row. Those pages will all be in the cache, hence no increased "Shared
Read Blocks", but will be counted as separate hits.

Remembering which pages we accessed previously would be quite
expensive...

Greetings,

Andres Freund