public inbox for [email protected]
help / color / mirror / Atom feedFrom: Laurenz Albe <[email protected]>
To: Greg Rychlewski <[email protected]>
To: [email protected]
Subject: Re: shared buffers
Date: Mon, 29 Mar 2021 19:09:02 +0200
Message-ID: <[email protected]> (raw)
In-Reply-To: <CAKemG7UgmsEQUmD74_CCKy5ahyEd8yWSt-Nr7BXNcZ=MKSLcRg@mail.gmail.com>
References: <CAKemG7UgmsEQUmD74_CCKy5ahyEd8yWSt-Nr7BXNcZ=MKSLcRg@mail.gmail.com>
On Mon, 2021-03-29 at 11:27 -0400, Greg Rychlewski wrote:
> Will every page touched during a table or index scan, even if it's
> not going to be used in the final result, be loaded into shared buffers?
>
> i.e. if you need to evaluate a filter condition, will it load that page
> into shared buffers and then evaluate it from there?
Even if a value does not appear in a query result, the page containing it
has to be read, if the value is used for calculating the query result.
All pages read are loaded into shared buffers. So yes, they will be loaded.
Note that there is an optimization for big sequential scans: if the table
scanned is bigger than a quarter of shared buffers, PostgreSQL will use a
small ring buffer to read the table. This prevents a large sequential scan
from blowing out your cache, since it uses the same buffers to scan
the whole table.
Yours,
Laurenz Albe
--
Cybertec | https://www.cybertec-postgresql.com
view thread (4+ messages) latest in thread
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected], [email protected]
Subject: Re: shared buffers
In-Reply-To: <[email protected]>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox