Обсуждение: Which files belong to which database?

Поиск
Список
Период
Сортировка

Which files belong to which database?

От
Oliver Fromme
Дата:
Hi,

Is there a way to find out which files in $PGDATA belong
to which database?  I need that information for accounting
purposes (users are billed per Gbyte of data).  In mysql
it is very easy, because the subdirectories have the same
names as the databases.

Thanks in advance!

Regards
   Oliver

--
Oliver Fromme, secnetix GmbH & Co KG, Oettingenstr. 2, 80538 München
Any opinions expressed in this message may be personal to the author
and may not necessarily reflect the opinions of secnetix in any way.

"C++ is to C as Lung Cancer is to Lung."
        -- Thomas Funke

Re: Which files belong to which database?

От
Oliver Elphick
Дата:
On Wed, 2003-09-10 at 11:13, Oliver Fromme wrote:
> Hi,
>
> Is there a way to find out which files in $PGDATA belong
> to which database?  I need that information for accounting
> purposes (users are billed per Gbyte of data).  In mysql
> it is very easy, because the subdirectories have the same
> names as the databases.

The subdirectories in $PGDATA/base are named by the database oid.

The contrib module, oid2name, can be used to retrieve the database
names.

--
Oliver Elphick                                Oliver.Elphick@lfix.co.uk
Isle of Wight, UK                             http://www.lfix.co.uk/oliver
GPG: 1024D/3E1D0C1C: CA12 09E0 E8D5 8870 5839  932A 614D 4C34 3E1D 0C1C
                 ========================================
     "Draw near to God and he will draw near to you.
      Cleanse your hands, you sinners; and purify your
      hearts, you double minded."       James 4:8


Re: Which files belong to which database?

От
Stephan Szabo
Дата:
On Wed, 10 Sep 2003, Oliver Fromme wrote:

> Is there a way to find out which files in $PGDATA belong
> to which database?  I need that information for accounting
> purposes (users are billed per Gbyte of data).  In mysql

I believe the structure in general is:
base/
base/<database oid>
base/<database oid>/<object relfilenoid>

In contrib there's a program, oid2name, which will show the name/number
mappings.