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