X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id BC32C9DC859 for ; Sun, 18 Dec 2005 21:04:42 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 53880-08 for ; Sun, 18 Dec 2005 21:04:45 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from tigger.fuhr.org (tigger.fuhr.org [63.214.45.158]) by postgresql.org (Postfix) with ESMTP id 4E83B9DC843 for ; Sun, 18 Dec 2005 21:04:39 -0400 (AST) Received: from winnie.fuhr.org (winnie.fuhr.org [10.1.0.1]) by tigger.fuhr.org (8.13.3/8.13.3) with ESMTP id jBJ14bNw093230 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Sun, 18 Dec 2005 18:04:39 -0700 (MST) (envelope-from mfuhr@winnie.fuhr.org) Received: from winnie.fuhr.org (localhost [127.0.0.1]) by winnie.fuhr.org (8.13.4/8.13.4) with ESMTP id jBJ14aLb089237; Sun, 18 Dec 2005 18:04:36 -0700 (MST) (envelope-from mfuhr@winnie.fuhr.org) Received: (from mfuhr@localhost) by winnie.fuhr.org (8.13.4/8.13.4/Submit) id jBJ14aNi089236; Sun, 18 Dec 2005 18:04:36 -0700 (MST) (envelope-from mfuhr) Date: Sun, 18 Dec 2005 18:04:36 -0700 From: Michael Fuhr To: Ken Hill Cc: Jeff Frost , pgsql-admin@postgresql.org Subject: Re: How to find data directory Message-ID: <20051219010436.GA89158@winnie.fuhr.org> References: <1134772264.7276.2.camel@localhost.localdomain> <1134784056.7354.2.camel@localhost.localdomain> <1134952457.7555.5.camel@localhost.localdomain> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1134952457.7555.5.camel@localhost.localdomain> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.028 required=5 tests=[AWL=0.028] X-Spam-Score: 0.028 X-Spam-Level: X-Archive-Number: 200512/191 X-Sequence-Number: 19911 On Sun, Dec 18, 2005 at 04:34:16PM -0800, Ken Hill wrote: > That works nice. It shows my data directory in > '/var/lib/postgresql/7.4/main'. When I do an ls command, I get: > > $ sudo ls /var/lib/postgresql/7.4/main > base pg_clog pg_ident.conf pg_xlog postmaster.opts > root.crt > global pg_hba.conf PG_VERSION postgresql.conf postmaster.pid > > I have created two database named 'testdb' and 'csalgorithm'. How do I > find these databases? I was expecting the databases to be subdirectories > under the database directory (e.g. /var/lib/postresql/7.4/main/testdb > and /var/lib/postgresql/7.4/main/csalgorithm). Database directories are under the "base" directory with names that match their oid in pg_database. So if pg_database has SELECT oid, datname FROM pg_database; oid | datname -------+----------- 1 | template1 17141 | template0 (2 rows) then the files for template1 will be under base/1 and the files for template0 will be under base/17141. In versions 8.0 and later you can control where database files go by using tablespaces, and earlier versions had an "alternative location" mechanism. See the "Managing Databases" chapter in the documentation to learn about those features. -- Michael Fuhr