From: huang <foggyglass@163.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-bugs@postgresql.org
Subject: Re: BUG #13830: pg_table_size and pg_indexes_size
Date: Thu, 24 Dec 2015 21:34:41 +0800
Message-ID: <567BF471.7090802@163.com> (raw)
In-Reply-To: <2682.1450894971@sss.pgh.pa.us>
References: <20151223145546.2688.94659@wrigleys.postgresql.org>
<2682.1450894971@sss.pgh.pa.us>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>
Mr. Tom Lane
Thank you for your explanation .:)
在 2015/12/24 2:22, Tom Lane 写道:
> foggyglass@163.com writes:
>> postgres=# create table b(id int);
>> CREATE TABLE
>> postgres=# create index b_idx on b(id);
>> CREATE INDEX
>> postgres=# select relname , pg_table_size(oid),pg_indexes_size(oid)
>> postgres-# from pg_class where relname in ('b','b_idx');
>> relname | pg_table_size | pg_indexes_size
>> ---------+---------------+-----------------
>> b | 0 | 8192
>> b_idx | 8192 | 0
>> (2 rows)
> Seems fine to me. b is empty at this point, so it has size zero.
> btree indexes, on the other hand, never have size zero because their
> metapage is created immediately. b_idx has no indexes attached to it,
> so pg_indexes_size finds nothing to report on and returns zero for
> that.
>
> If you insert any actual data, the results change:
>
> regression=# insert into b values(33);
> INSERT 0 1
> regression=# select relname , pg_table_size(oid),pg_indexes_size(oid) from pg_class where relname in ('b','b_idx');
> relname | pg_table_size | pg_indexes_size
> ---------+---------------+-----------------
> b | 8192 | 16384
> b_idx | 16384 | 0
> (2 rows)
>
> which maybe looks a bit saner.
>
> regards, tom lane
>
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
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: foggyglass@163.com, tgl@sss.pgh.pa.us
Subject: Re: BUG #13830: pg_table_size and pg_indexes_size
In-Reply-To: <567BF471.7090802@163.com>
References: <20151223145546.2688.94659@wrigleys.postgresql.org> <2682.1450894971@sss.pgh.pa.us> <567BF471.7090802@163.com>
* 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