Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1YBQXn-0001hV-Dd for pgsql-admin@arkaria.postgresql.org; Wed, 14 Jan 2015 16:11:43 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1YBQXm-0006ij-UY for pgsql-admin@arkaria.postgresql.org; Wed, 14 Jan 2015 16:11:42 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1YBQXm-0006id-4q for pgsql-admin@postgresql.org; Wed, 14 Jan 2015 16:11:42 +0000 Received: from plane.gmane.org ([80.91.229.3]) by makus.postgresql.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.80) (envelope-from ) id 1YBQXh-0003xw-B2 for pgsql-admin@postgresql.org; Wed, 14 Jan 2015 16:11:40 +0000 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1YBQXc-0007W4-M2 for pgsql-admin@postgresql.org; Wed, 14 Jan 2015 17:11:32 +0100 Received: from 185.40.248.10 ([185.40.248.10]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 14 Jan 2015 17:11:32 +0100 Received: from spam_eater by 185.40.248.10 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 14 Jan 2015 17:11:32 +0100 X-Injected-Via-Gmane: http://gmane.org/ To: pgsql-admin@postgresql.org From: Thomas Kellerer Subject: Re: How to identify all storage in a schema Date: Wed, 14 Jan 2015 17:11:20 +0100 Lines: 24 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: 185.40.248.10 User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.23) Gecko/20090812 Thunderbird/2.0.0.23 Mnenhy/0.7.6.666 In-Reply-To: X-Pg-Spam-Score: -0.6 (/) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-admin Precedence: bulk Sender: pgsql-admin-owner@postgresql.org Campbell, Lance schrieb am 14.01.2015 um 16:56: > PostgreSQL 9.3 > Is there a query one can run that will give you a total storage for all objects (tables, indexes, etc) associated with a particular schema? > > Thanks for your assistance. select table_schema, sum(pg_total_relation_size(table_schema|| '.' ||table_name)) from information_schema.tables where table_schema not in ('information_schema', 'pg_catalog') group by table_schema; Of for just a single schema: select sum(pg_total_relation_size(table_schema|| '.' ||table_name)) from information_schema.tables where table_schema = 'foobar'; There are other functions to retrieve the table or database sizes: http://www.postgresql.org/docs/current/static/functions-admin.html#FUNCTIONS-ADMIN-DBOBJECT Thomas -- Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-admin