pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: John R Pierce <pierce@hogranch.com>
To: pgsql-bugs@postgresql.org
Subject: Re: database and table information collect
Date: Mon, 19 Oct 2015 22:15:58 -0700
Message-ID: <5625CE0E.3050505@hogranch.com> (raw)
In-Reply-To: <CAD_D-c8dsOMpq5Yd=fx2uF-7nPEqxM8nDYj70hXR+WbW8pXg4A@mail.gmail.com>
References: <CAD_D-c9RsQ9kB_O4hAy9oogauQMxyeYDzQ8=6LahkmrparWBOA@mail.gmail.com>
	<20151020020700.GB15893@momjian.us>
	<CAD_D-c8dsOMpq5Yd=fx2uF-7nPEqxM8nDYj70hXR+WbW8pXg4A@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-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



-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



view thread (4+ messages)

Message-ID: <5625CE0E.3050505@hogranch.com>
Permalink:  ../5625CE0E.3050505@hogranch.com/
Also on:    postgresql.org/message-id/5625CE0E.3050505@hogranch.com

 · 

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: pierce@hogranch.com
  Subject: Re: database and table information collect
  In-Reply-To: <5625CE0E.3050505@hogranch.com>
  References: <CAD_D-c9RsQ9kB_O4hAy9oogauQMxyeYDzQ8=6LahkmrparWBOA@mail.gmail.com> <20151020020700.GB15893@momjian.us> <CAD_D-c8dsOMpq5Yd=fx2uF-7nPEqxM8nDYj70hXR+WbW8pXg4A@mail.gmail.com> <5625CE0E.3050505@hogranch.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