Physical location of objects in a PostgreSQL database?

I am interested in getting the physical layout of tables, views, functions, data / content available in PostgreSQL tables on Linux. I have a script that PostgreSQL can be installed on the SD-Card and on the hard drive. If I have tables, views, functions, data in SD, I want to get physical locations and merge / copy to my hard drive when I want to replace the memory space. I hope that database storage should be in the form of a simple file architecture.

Also, is it possible to view the contents of files? I mean, can I access them?

+7
source share
3 answers

, . :

SELECT pg_relation_filepath('my_table');

, , .

PGDATA/base:

, . " " :

PGDATA/base, OID pg_database. ; , .

...

. , pg_class.relfilenode.

...

pg_relation_filepath() ( PGDATA) .

.
pg_relation_filepath().

+6

show data_directory; . , .

PostgreSQL tablespaces. . PostgreSQL , . , , , .

, , , , pg_database, pg_tablespace pg_tables . information_schema.

. pg_dump - .

+5

, , , , " " (PITR):

http://www.postgresql.org/docs/current/interactive/backup.html

, , . -, . , ( ). -, E.F. Codd, , ; . 8, 9, 11 12 Codd 12.

+3

All Articles