Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1ZoPHU-0003fU-Mc for pgsql-bugs@arkaria.postgresql.org; Tue, 20 Oct 2015 05:16:16 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1ZoPHT-0005dA-GJ for pgsql-bugs@arkaria.postgresql.org; Tue, 20 Oct 2015 05:16:15 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1ZoPHS-0005d1-2X for pgsql-bugs@postgresql.org; Tue, 20 Oct 2015 05:16:14 +0000 Received: from hogranch.com ([75.101.82.47]) by magus.postgresql.org with esmtp (Exim 4.84) (envelope-from ) id 1ZoPHN-0007Bz-Rq for pgsql-bugs@postgresql.org; Tue, 20 Oct 2015 05:16:12 +0000 Received: from [192.168.0.2] (porker [192.168.0.2]) by hogranch.com (8.11.6/8.11.6) with ESMTP id t9K5G3H22983 for ; Mon, 19 Oct 2015 22:16:03 -0700 Subject: Re: database and table information collect To: pgsql-bugs@postgresql.org References: <20151020020700.GB15893@momjian.us> From: John R Pierce Message-ID: <5625CE0E.3050505@hogranch.com> Date: Mon, 19 Oct 2015 22:15:58 -0700 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-HawgScanner-Information: Please contact the ISP for more information X-HawgScanner: Found to be clean X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org 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