Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id DDB8AB5DC3E for ; Tue, 25 Oct 2011 05:58:46 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.29]) (amavisd-maia, port 10024) with ESMTP id 29983-02 for ; Tue, 25 Oct 2011 08:58:46 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.8.0-rc2 Received: from wwwmaster.postgresql.org (wwwmaster.postgresql.org [217.196.146.204]) by mail.postgresql.org (Postfix) with ESMTP id 477DCB5DC35 for ; Tue, 25 Oct 2011 05:58:46 -0300 (ADT) Received: from wwwmaster.postgresql.org (wwwmaster.postgresql.org [217.196.146.204]) by wwwmaster.postgresql.org (8.14.3/8.14.3) with ESMTP id p9P8wj5Z085633 for ; Tue, 25 Oct 2011 08:58:45 GMT (envelope-from www@wwwmaster.postgresql.org) Received: (from www@localhost) by wwwmaster.postgresql.org (8.14.3/8.14.3/Submit) id p9P8wjcQ085632; Tue, 25 Oct 2011 08:58:45 GMT (envelope-from www) Date: Tue, 25 Oct 2011 08:58:45 GMT Message-Id: <201110250858.p9P8wjcQ085632@wwwmaster.postgresql.org> To: pgsql-bugs@postgresql.org Subject: BUG #6267: Wrong results in pg_database_size From: "Maksym Boguk" Content-Type: text/plain; charset=utf-8 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 201110/223 X-Sequence-Number: 31493 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.