Locating PostgreSQL data directory

Use a simple psql query to find the location of the data directory
postgres=# SHOW data_directory;
data_directory
------------------------------
/var/lib/postgresql/8.4/main
(1 row)

Or

postgres=# select setting from pg_settings where name = 'data_directory';
setting
------------------------------
/var/lib/postgresql/8.4/main
(1 row)

No related posts.

Related posts brought to you by Yet Another Related Posts Plugin.

This entry was posted in tips and tagged . Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>