Re: BUG #6267: Wrong results in pg_database_size

From: Maxim Boguk <maxim(dot)boguk(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #6267: Wrong results in pg_database_size
Date: 2011-10-25 22:54:08
Message-ID: CAK-MWwR5dchDMpOh-qzdQhcB9Kp4j-pVZEx5LxMOZ4w5dM9zTQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

> "Maksym Boguk" <maxim(dot)boguk(at)gmail(dot)com> writes:
>> Somehow pg_database_size producing results which are 2х more then reality.
>
> I can't reproduce any such problem here.  I suspect you overlooked some
> tablespaces in your manual "du" commands.
>
>                        regards, tom lane
>

No other tablespaces exists as can be seen in output of:
SELECT oid,spcname,spclocation,pg_size_pretty(pg_tablespace_size(spcname)) from
pg_tablespace;
oid | spcname | spclocation | pg_size_pretty
-------+------------+---------------+----------------
1663 | pg_default | | 21 MB
1664 | pg_global | | 1092 kB
16443 | main | /db/base/main | 124 GB

However I seem to have found reason for such strange behavior.

That is a duplicating link in pg_tblspc:
postgres(at)db:~$ ls -la /var/lib/postgresql/9.0/main/pg_tblspc/
total 8
drwx------ 2 postgres postgres 4096 Jun 3 04:08 .
drwx------ 12 postgres postgres 4096 Sep 28 17:08 ..
lrwxrwxrwx 1 postgres postgres 13 Jun 6 14:39 16384 -> /db/base/main
lrwxrwxrwx 1 postgres postgres 13 Jun 3 04:08 16443 -> /db/base/main

I have no idea how could this happen.
No crashes/power-offs and so on happens on that database for more then year.

Can the second (16384 -> /db/base/main) link be safely deleted?

--
Maxim Boguk
Senior Postgresql DBA.

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2011-10-25 23:30:07 Re: BUG #6267: Wrong results in pg_database_size
Previous Message bricklen 2011-10-25 21:16:28 Re: auto_explain causes cluster crash if pg_ctl reload is used (not pg_ctl restart)