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

From Maksym Boguk
Subject BUG #6267: Wrong results in pg_database_size
Date
Msg-id 201110250858.p9P8wjcQ085632@wwwmaster.postgresql.org
Whole thread Raw
Responses Re: BUG #6267: Wrong results in pg_database_size  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-bugs
The following bug has been logged online:

Bug reference:      6267
Logged by:          Maksym Boguk
Email address:      maxim.boguk@gmail.com
PostgreSQL version: 9.0.4
Operating system:   Linux 2.6.32-5
Description:        Wrong results in pg_database_size
Details:

Somehow pg_database_size producing results which are 2х more then reality.

Here is details:
postgres=# SELECT
oid,datname,dattablespace,pg_size_pretty(pg_database_size(datname)) from
pg_database where datname IN  ('plus1', 'stinger_3');
  oid  |  datname  | dattablespace | pg_size_pretty
-------+-----------+---------------+----------------
 16453 | plus1     |         16443 | 103 GB
 16458 | stinger_3 |         16443 | 114 GB


In reality they are 2x smaller:
postgres@shalyapin:/home/mboguk$ du --max-depth=1 -h
/db/base/main/PG_9.0_201008051/16453
52G     /db/base/main/PG_9.0_201008051/16453
postgres@shalyapin:/home/mboguk$ du --max-depth=1 -h
/db/base/main/PG_9.0_201008051/16458
58G     /db/base/main/PG_9.0_201008051/16458

pg_tablespace_size producing correct results
postgres=# 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


May be database located outside of the pg_default get his size calculated
twice (now sure how).

All other databases on that cluster have same wronge results about database
size including template0/template1 databases.

pgsql-bugs by date:

Previous
From: Sally Nayer
Date:
Subject: Re: BUG #6266: Create temp tables on Slave
Next
From: "Roman Lytovchenko"
Date:
Subject: BUG #6268: multiple update with on cascade