Re: database and table information collect

From: John R Pierce <pierce(at)hogranch(dot)com>
To: pgsql-bugs(at)postgresql(dot)org
Subject: Re: database and table information collect
Date: 2015-10-20 05:15:58
Message-ID: 5625CE0E.3050505@hogranch.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On 10/19/2015 9:30 PM, 許耀彰 wrote:
> Dear Bruce,
> How do we know our database situation as listed as below: (How many
> size of each table used condition? ) Thank you.

these questions would better be asked of the pg_general email list, and
not the bug reporting mail list, as they are not bug reports.

that said, this was answered when you asked it 3 days ago... there's a
series of functions like pg_relation_size(), pg_total_relation_size()
which will give you the size of a specific table. these are all
documented here,
http://www.postgresql.org/docs/current/static/functions-admin.html

if you want the size of every table, then you could do something like...

select table_schema || '.' || table_name,
pg_size_pretty(pg_total_relation_size(table_schema||'.'||table_name))
from informa
tion_schema.tables where table_schema not in ('pg_catalog',
'information_schema') order by pg_total_relation_size(table_schema||'.'|
|table_name) desc;

--
john r pierce, recycling bits in santa cruz

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message vtamara 2015-10-20 11:08:57 BUG #13690: Full Text Search with spanish dictionary cannot find some words
Previous Message kangjoni76 2015-10-20 04:37:37 BUG #13689: Build failed pg9.4.5 with mingw5.1