Thread: newbie questions

newbie questions

From
"Mark Parker"
Date:
Hi all,
    I've inherited some postgres databases and have a couple of questions
I'm hoping someone can help me out with.
    First, is there a way to link the file in the database directory, which
are all numbers, to specific databases?
    Second, I've got some dbs that have some really huge files. A nightly
vacuum (not full) is running. Several of the files have names followed by
rev numbers and are the same size; viz:
-rw-------    1 postgres postgres 1073741824 Nov 19 05:32 144287855
-rw-------    1 postgres postgres 1073741824 Nov 19 03:45 144287855.1
-rw-------    1 postgres postgres 1073741824 Nov 19 03:44 144287855.2
-rw-------    1 postgres postgres 1073741824 Nov 19 03:46 144287855.3
-rw-------    1 postgres postgres 1073741824 Nov 19 03:46 144287855.4
-rw-------    1 postgres postgres 1073741824 Nov 19 03:46 144287855.5
-rw-------    1 postgres postgres 1073741824 Nov 19 05:32 144287855.6
-rw-------    1 postgres postgres 12951552 Nov 19 05:32 144287855.7

    This looks fishy to me. Is it? I know that there's no way that the db in
question could have 7gb of data in it.
    I've been told that the way they've been getting the db back to a
reasonable size was via the ps_dump, drop table, recreate table psql <
dumpfile routing. Seems a bit excessive.

    Can someone gimmie some advice please please please? Or point me to the
docs that'll clear up my confusion as I've not found them on my own.

-Mark




Re: newbie questions

From
Peter Eisentraut
Date:
Mark Parker writes:

>     First, is there a way to link the file in the database directory, which
> are all numbers, to specific databases?

contrib/oid2name

>     Second, I've got some dbs that have some really huge files. A nightly
> vacuum (not full) is running.

Non-full vacuum does not shrink the table files on disk; it just remembers
the space for reuse.  So you should try a full vacuum to see if things
shrink.

>     I've been told that the way they've been getting the db back to a
> reasonable size was via the ps_dump, drop table, recreate table psql <
> dumpfile routing. Seems a bit excessive.

That could have been the case if the files concerned belong to an index.
In that case it's preferrable to try REINDEX.

--
Peter Eisentraut   peter_e@gmx.net