Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where does PostgreSQL store the database?

Tags:

postgresql

Where are the files for a PostgreSQL database stored?

like image 640
Teifion Avatar asked Jul 16 '09 11:07

Teifion


2 Answers

To see where the data directory is, use this query.

show data_directory; 

To see all the run-time parameters, use

show all; 

You can create tablespaces to store database objects in other parts of the filesystem. To see tablespaces, which might not be in that data directory, use this query.

SELECT *, pg_tablespace_location(oid) FROM pg_tablespace; 
like image 129
Mike Sherrill 'Cat Recall' Avatar answered Oct 26 '22 23:10

Mike Sherrill 'Cat Recall'


On Windows7 all the databases are referred by a number in the file named pg_database under C:\Program Files (x86)\PostgreSQL\8.2\data\global. Then you should search for the folder name by that number under C:\Program Files (x86)\PostgreSQL\8.2\data\base. That is the content of the database.

like image 33
senthilkumari Avatar answered Oct 26 '22 23:10

senthilkumari