1

I want to check how files, where PostgreSQL stores data from tables, are stored, for educational purposes. How can I do it?

I tried open it with notepad, but structure is corupt database heap file. "How should I open this file so that it is structured in a normal page view as:

 * +----------------+---------------------------------+
 * | PageHeaderData | linp1 linp2 linp3 ...           |
 * +-----------+----+---------------------------------+
 * | ... linpN |                                      |
 * +-----------+--------------------------------------+
 * |           ^ pd_lower                             |
 * |                                                  |
 * |             v pd_upper                           |
 * +-------------+------------------------------------+
 * |             | tupleN ...                         |
 * +-------------+------------------+-----------------+
 * |       ... tuple3 tuple2 tuple1 | "special space" |
 * +--------------------------------+-----------------+ 
1
  • 2
    You can use the pageinpsect extension. Example Commented Feb 9, 2024 at 12:01

1 Answer 1

3

These files are binary files, not text files. That image is just a conceptual drawing. You'd need a hex editor to look at the data, but if you want to see them presented in human readable form, you should use the functions in the pageinspect extension, in particular the heap_page_items() and heap_page_item_attrs() functions.

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.