1

If I am correct, SQLite stores a database per file, and a file can't store more than one databases.

How does PostgreSQL store a database in terms of file(s)? Does it also store a database per file, and a file can't store more than one databases?

1

1 Answer 1

4

(SQLite uses more than one file for the rollback journal or when in WAL mode.)

The PostgreSQL database file layout is documented in its documentation:

Each table and index is stored in a separate file. For ordinary relations, these files are named after the table or index's filenode number, which can be found in pg_class.relfilenode. […] in addition to the main file (a/k/a main fork), each table and index has a free space map …, which stores information about free space available in the relation. The free space map is stored in a file named with the filenode number plus the suffix _fsm. Tables also have a visibility map, stored in a fork with the suffix _vm, to track which pages are known to have no dead tuples. […]

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.