sheidaei
sheidaei

Reputation: 10332

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?

Upvotes: 8

Views: 23691

Answers (2)

sheidaei
sheidaei

Reputation: 10332

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

Upvotes: 13

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.

Upvotes: 3

Related Questions