Thread: Datafiles for Databases

Datafiles for Databases

From
"Kumar"
Date:
Dear Friends,
 
I was looking for a structure like oracle or ms Sql server in Postgres. What I have expected is individual datafiles for individual databases. But i cant fine such items in the /usr/local/pgsql/data directory.
 
Will the postgres create individual data file for databases?
 
How to get the datafile path of a database?
 
Please shed light.
 
Regards
Kumar

Re: Datafiles for Databases

From
"A.Bhuvaneswaran"
Date:
> Will the postgres create individual data file for databases?

Yes.

> How to get the datafile path of a database?

/var/lib/pgsql/data/base/, database directory name = pg_database.oid. You
can also use oid2name contrib module for finer detail.

regards,
bhuvaneswaran



Re: Datafiles for Databases

From
Christopher Browne
Date:
In the last exciting episode, sgnerd@yahoo.com.sg ("Kumar") wrote:
> I was looking for a structure like oracle or ms Sql server in Postgres. What I have expected is individual
> datafiles for individual databases. But i cant fine such items in the /usr/local/pgsql/data directory.
>
> Will the postgres create individual data file for databases?

No.  Just as with Oracle, PostgreSQL creates multiple files for each
database.

> How to get the datafile path of a database?

select oid, datname from pg_database;

The path for database 'datname' will be:  $PGDATA/base/oid/
-- 
"aa454","@","freenet.carleton.ca"
http://cbbrowne.com/info/x.html
People can be set wondering by loading obscure personal patchable
systems, and sending bug reports.  Who would not stop and wonder upon
seeing "Experimental TD80-TAPE 1.17, MegaDeath 2.5..."?  The same for
provocatively-named functions and variables in stack traces.
-- from the Symbolics Guidelines for Sending Mail


Re: Datafiles for Databases

From
Bruce Momjian
Date:
Christopher Browne wrote:
> In the last exciting episode, sgnerd@yahoo.com.sg ("Kumar") wrote:
> > I was looking for a structure like oracle or ms Sql?server in Postgres. What I have expected is individual
> > datafiles for individual databases. But i cant fine such items in the /usr/local/pgsql/data directory.
> >
> > Will the postgres create individual data file for databases?
> 
> No.  Just as with Oracle, PostgreSQL creates multiple files for each
> database.
> 
> > How to get the datafile path of a database?
> 
> select oid, datname from pg_database;
> 
> The path for database 'datname' will be:
>    $PGDATA/base/oid/

See the "Monitoring Disk Space" section in our manuals.

--  Bruce Momjian                        |  http://candle.pha.pa.us pgman@candle.pha.pa.us               |  (610)
359-1001+  If your life is a hard drive,     |  13 Roberts Road +  Christ can be your backup.        |  Newtown Square,
Pennsylvania19073