You will see the heap files under the database folder like below, $ ls -ltrh /home/user/pgdata/base/12705/16384* Postgres=# insert into orders1 values(1, 'hello world!') For example, postgres=# create table orders1 (id int4, test text) using heap However, the Heap files will not be created unless you insert the first record to the table. The table oid will be used as the file name to create the corresponding heap file. Where, spcNode is the tablespace oid, dbNode is the database oid, and relNode is table oid. RelFileNode defined in src/include/storage/felfilenode.h.To explain this, let’s take a look at two key data structures. In this blog, I am going to share what I learned about the heap files under base folder. I can do a simple command like below to check the file PG_VERSION, but what about the rest of the files and folders? $ cat /home/user/pgdata/PG_VERSION rw- 1 user user 3 Oct 8 13:38 PG_VERSION For example, $ ls -ltr /home/user/pgdataĭrwx- 4 user user 4096 Oct 8 13:38 pg_logicalĭrwx- 5 user user 4096 Oct 8 13:38 baseĭrwx- 2 user user 4096 Oct 8 13:38 global The reason is that I always see a lot of files and folders were created after a simple initdb command. As a software developer, I was always curious about how each part was done, such as the physical files storage. PostgreSQL is a great open source database, and many users chose it because of the efficiency of its central algorithms and data structures.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |