[postgis-users] How to get the size of a postgis table ?
Michael Fuhr
mike at fuhr.org
Tue Feb 14 16:00:46 PST 2006
On Tue, Feb 14, 2006 at 03:37:54PM -0800, Aaron Koning wrote:
> Size of files on disk - Method 1:
> - SELECT relpages * 8192 AS size_in_bytes FROM pg_class WHERE relnamespace
> = (SELECT oid FROM pg_namespace WHERE nspname = '<schema_name>') AND relname
> = '<table_name>'
> - Note: This value is only updated by the commands VACUUM, ANALYZE, and
> CREATE INDEX.
Also note that this shows only the number of pages in the relation
itself, not any associated indexes or toast tables. In PostgreSQL
8.1 take a look at pg_total_relation_size() and friends:
http://www.postgresql.org/docs/8.1/interactive/functions-admin.html#FUNCTIONS-ADMIN-DBSIZE
In earlier versions the contrib/dbsize module can be handy. The
README has an example query to get a relation's total size, including
indexes and toast tables.
--
Michael Fuhr
More information about the postgis-users
mailing list