Re: How does backend server know which data file and pageto read? - Mailing list pgsql-novice

From Albe Laurenz
Subject Re: How does backend server know which data file and pageto read?
Date
Msg-id A737B7A37273E048B164557ADEF4A58B53A1768D@ntex2010i.host.magwien.gv.at
Whole thread Raw
In response to How does backend server know which data file and page to read?  (anand086 <anand086@gmail.com>)
List pgsql-novice
anand086 wrote:
> I would like to know, how does postgresql backend process know which data
> file and page number to read from when a sql is fired by client.

The PostgreSQL documentation on physical data layout will nicely
complement my explanations:
https://www.postgresql.org/docs/current/static/storage-file-layout.html

The file can be found using the "relfilenode" column in the
"pg_class" entry for the table.

To find the correct block, there are two ways:

- Read the whole table and search all blocks, filtering
  the data you need.  This is called "sequential scan".

- Use an index to search for keys.  The index entry points
  to the physical address of the data, which contains the
  block number.  This is an "index scan".

Yours,
Laurenz Albe

pgsql-novice by date:

Previous
From: anand086
Date:
Subject: How does backend server know which data file and page to read?
Next
From: Dwaraka Srinivasan
Date:
Subject: [NOVICE] select for share error when inserting data in RDS