From: huang <foggyglass@163.com>
To: David G. Johnston <david.g.johnston@gmail.com>
Cc: pgsql-bugs@postgresql.org <pgsql-bugs@postgresql.org>
Subject: Re: BUG #13830: pg_table_size and pg_indexes_size
Date: Thu, 24 Dec 2015 21:32:09 +0800
Message-ID: <567BF3D9.5070604@163.com> (raw)
In-Reply-To: <CAKFQuwYkwyTh1MtTs5rCQteGAMqQco2EU_GaCZTkSHo2cNv=hg@mail.gmail.com>
References: <20151223145546.2688.94659@wrigleys.postgresql.org>
<CAKFQuwYkwyTh1MtTs5rCQteGAMqQco2EU_GaCZTkSHo2cNv=hg@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>
Mr. David ,
thank you for your explanation .
T.T
在 2015/12/24 2:18, David G. Johnston 写道:
> On Wed, Dec 23, 2015 at 7:55 AM, <foggyglass@163.com
> <mailto:foggyglass@163.com>>wrote:
>
> The following bug has been logged on the website:
>
> Bug reference: 13830
> Logged by: T_T
> Email address: foggyglass@163.com <mailto:foggyglass@163.com>
> PostgreSQL version: 9.5rc1
> Operating system: centos7
> Description:
>
> Hi friend,
> I think there is a error about pg_table_size and
> pg_indexes_size in
> PostgreSQL .
> This is my operation log
>
> [postgres@c7 bin]$./psql
> psql (9.5beta2)
> Type "help" for help.
>
> 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)
>
> postgres=#
>
> The b_idex is a index , but pg_indexes_size does not show its size
> . The b
> is a table , but pg_table_size does not show its size .I think the
> pg_table_size show the b size , but not pg_indexes_size .
>
>
> Working as documented.
>
> Table "b" has no size of its own - however its one index has a size of
> 8192.
>
> An index is sometimes considered a "table", in this case when using
> pg_table_size, and so
> you get 8192 as the size of the index table (i.e., relation). Since
> an index doesn't have an index of its own pg_indexes_size returns 0.
>
> pg_table_size on "b" returns zero since its size is zero and the
> calculation excludes indexes. pg_indexes_size on "b" returns the size
> of "b_idx" which is 8192.
>
> http://www.postgresql.org/docs/9.5/interactive/functions-admin.html
>
> David J.
>
>
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, david.g.johnston@gmail.com
Subject: Re: BUG #13830: pg_table_size and pg_indexes_size
In-Reply-To: <567BF3D9.5070604@163.com>
References: <20151223145546.2688.94659@wrigleys.postgresql.org> <CAKFQuwYkwyTh1MtTs5rCQteGAMqQco2EU_GaCZTkSHo2cNv=hg@mail.gmail.com> <567BF3D9.5070604@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