Re: BUG #6267: Wrong results in pg_database_size - Mailing list pgsql-bugs

From Maxim Boguk
Subject Re: BUG #6267: Wrong results in pg_database_size
Date
Msg-id CAK-MWwR5dchDMpOh-qzdQhcB9Kp4j-pVZEx5LxMOZ4w5dM9zTQ@mail.gmail.com
Whole thread Raw
In response to Re: BUG #6267: Wrong results in pg_database_size  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: BUG #6267: Wrong results in pg_database_size  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-bugs
> "Maksym Boguk" <maxim.boguk@gmail.com> writes:
>> Somehow pg_database_size producing results which are 2=D1=85 more then r=
eality.
>
> I can't reproduce any such problem here. =C2=A0I suspect you overlooked s=
ome
> tablespaces in your manual "du" commands.
>
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0regards, 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@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?

--=20
Maxim Boguk
Senior Postgresql DBA.

pgsql-bugs by date:

Previous
From: bricklen
Date:
Subject: Re: auto_explain causes cluster crash if pg_ctl reload is used (not pg_ctl restart)
Next
From: Tom Lane
Date:
Subject: Re: BUG #6267: Wrong results in pg_database_size