On Thu, 21 Nov 2002 19:20:16 +0100
"Henrik Steffen" <steffen@city-map.de> wrote:
> sorry, didn't notice your message posted to pgsql-general...
>
> but is there any method to see the size in bytes a particular index
> for a particular table takes?
For a table foo, do:
psql mydatabase
-- first find the index name:
mydatabase=> \d foo
...
Indexes: foo_pkey unique btree (mykey)
-- now find the unix file name of the index:
mydatabase=> select relfilenode from pg_class where relname='foo_pkey';
relfilenode
-------------
18122
-- Thus the file name of the index is "18122".
\q
# now go and look for the file:
unixprompt> su postgres
Password:
postgres> cd /var/lib/pgsql/data/base/????
postgres> ls -l 18122
-rw------- 1 postgres daemon 7471104 Nov 21 12:52 18122
Thus the index for table foo is 7.4 MBytes in size. What I left
out is the ???? directory name above. I find it by educated guess.
Does someone know the right way to map from database name to
data directory name?
-- George
> From: "scott.marlowe" <scott.marlowe@ihs.com>
> To: "Henrik Steffen" <steffen@city-map.de>
> Cc: <pgsql-performance@postgresql.org>
> Sent: Thursday, November 21, 2002 6:32 PM
> Subject: Re: [PERFORM] vacuum full
>
>
> > On Thu, 21 Nov 2002, Henrik Steffen wrote:
> > >
> > > how often should "vacuum full" usually be run ?
> >
> > I recommend nightly. Also, check index size. If they are growing, you
> > may want to reindex each night or week as well.
--
I cannot think why the whole bed of the ocean is
not one solid mass of oysters, so prolific they seem. Ah,
I am wandering! Strange how the brain controls the brain!
-- Sherlock Holmes in "The Dying Detective"