BUG #6267: Wrong results in pg_database_size

From: "Maksym Boguk" <maxim(dot)boguk(at)gmail(dot)com>
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #6267: Wrong results in pg_database_size
Date: 2011-10-25 08:58:45
Message-ID: 201110250858.p9P8wjcQ085632@wwwmaster.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs


The following bug has been logged online:

Bug reference: 6267
Logged by: Maksym Boguk
Email address: maxim(dot)boguk(at)gmail(dot)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(at)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(at)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.

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Roman Lytovchenko 2011-10-25 08:58:55 BUG #6268: multiple update with on cascade
Previous Message Sally Nayer 2011-10-25 07:11:23 Re: BUG #6266: Create temp tables on Slave