Re: How does Postgres store a B-Tree on disk while using the OS file system? - Mailing list pgsql-general

From Christophe Pettus
Subject Re: How does Postgres store a B-Tree on disk while using the OS file system?
Date
Msg-id 22FFB64D-AA07-4E47-A982-3B25743F7E02@thebuild.com
Whole thread Raw
In response to How does Postgres store a B-Tree on disk while using the OS file system?  (Siddharth Jain <siddhsql@gmail.com>)
Responses Re: How does Postgres store a B-Tree on disk while using the OS file system?  (Siddharth Jain <siddhsql@gmail.com>)
List pgsql-general

> On Mar 6, 2023, at 16:24, Siddharth Jain <siddhsql@gmail.com> wrote:
> My question: How can it then store a B Tree on disk? I would think storing a B Tree requires storing disk offset
addressesand so on (for a node to navigate to another etc.). For this, one would need to write directly to the disk
usinglow-level disk access functions and not use file system API. 

All of PostgreSQL's relations (tables and indexes) are stored in files.  (They're actually stored in a set of files if
it'slarger than 1GB, but each relation is treated as one logical file.)  The "pointers" in this case are just offsets
fromthe start of that file. 

There's some additional information here:

    https://www.postgresql.org/docs/current/storage.html

and here:

    https://www.postgresql.org/docs/current/btree-implementation.html


pgsql-general by date:

Previous
From: Ron
Date:
Subject: Re: How does Postgres store a B-Tree on disk while using the OS file system?
Next
From: David Rowley
Date:
Subject: Re: Idea: PostgreSQL equivalent to Oracle's KEEP clause