Обсуждение: How does backend server know which data file and page to read?

Поиск
Список
Период
Сортировка

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

От
anand086
Дата:
Hi,

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.




--
View this message in context:
http://www.postgresql-archive.org/How-does-backend-server-know-which-data-file-and-page-to-read-tp5952476.html
Sent from the PostgreSQL - novice mailing list archive at Nabble.com.


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

От
Albe Laurenz
Дата:
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