Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PostgreSQL data file location

I am using PostgreSQL on Mac, I have created several databases using command line. I am looking into /Library/PostgreSQL/9.2/data and I can not see any .dat file. Am I looking into the wrong place for data files?

I have used the following command: ps auxw | grep postgres | grep -- -D as mentioned PostgreSQL database default location on Linux and it gives me the /Library/PostgreSQL/9.2/data directory.

Any ideas?

like image 735
sheidaei Avatar asked Jan 04 '13 16:01

sheidaei


2 Answers

select setting from pg_settings where name = 'data_directory'

and

ps auxw | grep postgres | grep -- -D 

both generate the same result. The first one through postgresql, second one command line. Thanks to @a_horse_with_no_name

like image 188
2 revs, 2 users 80% Avatar answered Oct 13 '22 22:10

2 revs, 2 users 80%


PostgreSQL lets you store data in relatively arbitrary locations in the filesystem. The default location, which you can get with show data_directory, isn't the whole story.

like image 41
Mike Sherrill 'Cat Recall' Avatar answered Oct 13 '22 22:10

Mike Sherrill 'Cat Recall'