Re: How does backend server know which data file and page to read?

From: Albe Laurenz <laurenz(dot)albe(at)wien(dot)gv(dot)at>
To: "'anand086 *EXTERN*'" <anand086(at)gmail(dot)com>, "pgsql-novice(at)postgresql(dot)org" <pgsql-novice(at)postgresql(dot)org>
Subject: Re: How does backend server know which data file and page to read?
Date: 2017-03-28 09:40:31
Message-ID: A737B7A37273E048B164557ADEF4A58B53A1768D@ntex2010i.host.magwien.gv.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Dwaraka Srinivasan 2017-04-12 05:31:14 select for share error when inserting data in RDS
Previous Message anand086 2017-03-28 06:10:31 How does backend server know which data file and page to read?