Figure a table with fields a, b and c
Figure two requests on this table :
SELECT a, b from table
SELECT b, c from table
Is postgres able to reuse cache for the second request?
performancepostgresqlpostgresql-performancequery-performance
Figure a table with fields a, b and c
Figure two requests on this table :
SELECT a, b from table
SELECT b, c from table
Is postgres able to reuse cache for the second request?
Best Answer
The cache stores blocks read from from disk. A single block contains one or more rows from a table.
As both queries read the same data, they request the same blocks. So yes, the second query will be reading the blocks from the cache.