[postgis-users] How to get the size of a postgis table ?

Aaron Koning aaronkoning at gmail.com
Tue Feb 14 15:37:54 PST 2006


------------------------------------------
Number of rows in the table:
     SELECT count(*) FROM <table_name>;

------------------------------------------
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.

------------------------------------------
Size of files on disk - Method 2:
  - Run this command to find the file node number for a particular table:
       SELECT relfilenode FROM pg_class WHERE relnamespace = (SELECT oid
FROM pg_namespace WHERE nspname = '<schema_name>') AND relname =
'<table_name>'
  - Then run ls -l <your postgres data directory>/base/<file node number>
       Example: ls -l /usr/local/pgsql/data/base/17384



Aaron

On 2/14/06, Ezequias Rodrigues da Rocha <ezequias at recife.pe.gov.br> wrote:
>
> Hi list,
>
> I would like to know how to get the size of a postgis table ? I did a
> upload of a shapefile into postgis but I am not certain of the size of it.
>
> I am worried becouse I need about 10 minutes to load a 6mb shapefile on
> a WFS service.
>
>
>
> Sincerely...
>
> --
> Ezequias Rodrigues da Rocha
> http://ezequiasrocha.blogspot.com
> msn:ezequias at hotmail.com
> "the worst of democracies is still better than the best of dictatorship"
>
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
>



--
+--------------------------------------------
|  Aaron Koning
|  Information Technologist
|  Prince George, BC, Canada.
+--------------------------------------------
|  http://datashare.gis.unbc.ca/fist/
|  http://datashare.gis.unbc.ca/gctp-js/
+--------------------------------------------
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20060214/bb6e4db7/attachment.html>


More information about the postgis-users mailing list