pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Maksym Boguk <maxim.boguk@gmail.com>
To: pgsql-bugs@postgresql.org
Subject: BUG #6267: Wrong results in pg_database_size
Date: Tue, 25 Oct 2011 08:58:45 GMT
Message-ID: <201110250858.p9P8wjcQ085632@wwwmaster.postgresql.org> (raw)


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.



view thread (4+ messages)  latest in thread

Message-ID: <201110250858.p9P8wjcQ085632@wwwmaster.postgresql.org>
Permalink:  ../201110250858.p9P8wjcQ085632@wwwmaster.postgresql.org/
Also on:    postgresql.org/message-id/201110250858.p9P8wjcQ085632@wwwmaster.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: maxim.boguk@gmail.com
  Subject: Re: BUG #6267: Wrong results in pg_database_size
  In-Reply-To: <201110250858.p9P8wjcQ085632@wwwmaster.postgresql.org>
  References: <201110250858.p9P8wjcQ085632@wwwmaster.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox