From: Regina Obe Date: Sun, 22 Jun 2014 02:51:03 +0000 (+0000) Subject: #2770 Document new ST_MemSize for raster and #2769 name change for geometry (ST_MEm_S... X-Git-Tag: 2.2.0rc1~1076 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=240dcd98f6524a752edbc2bfca6b791e54cc8cc4;p=postgis #2770 Document new ST_MemSize for raster and #2769 name change for geometry (ST_MEm_Size to ST_MemSize) git-svn-id: http://svn.osgeo.org/postgis/trunk@12634 b70326c6-7e19-0410-871a-916f4a2858ee --- diff --git a/doc/reference_misc.xml b/doc/reference_misc.xml index 2ce96f375..d543be842 100644 --- a/doc/reference_misc.xml +++ b/doc/reference_misc.xml @@ -528,9 +528,9 @@ find_srid - + - ST_Mem_Size + ST_MemSize Returns the amount of space (in bytes) the geometry takes. @@ -538,7 +538,7 @@ find_srid - integer ST_Mem_Size + integer ST_MemSize geometry geomA @@ -548,16 +548,18 @@ find_srid Description Returns the amount of space (in bytes) the geometry takes. - This is a nice compliment to PostgreSQL built in functions pg_size_pretty, pg_relation_size, pg_total_relation_size. - pg_relation_size which gives the byte size of a table may return byte size lower than ST_Mem_Size. This is because + This is a nice compliment to PostgreSQL built in functions pg_column_size, pg_size_pretty, pg_relation_size, pg_total_relation_size. + pg_relation_size which gives the byte size of a table may return byte size lower than ST_MemSize. This is because pg_relation_size does not add toasted table contribution and large geometries are stored in TOAST tables. pg_total_relation_size - includes, the table, the toasted tables, and the indexes. + pg_column_size returns how much space a geometry would take in a column considering compression, so may be lower than ST_MemSize &Z_support; &curve_support; &P_support; &T_support; + Changed: 2.2.0 name changed to ST_MemSize to follow naming convention. In prior versions this function was called ST_Mem_Size, old name deprecated though still available. @@ -566,10 +568,10 @@ find_srid --Return how much byte space Boston takes up in our Mass data set -SELECT pg_size_pretty(SUM(ST_Mem_Size(the_geom))) as totgeomsum, -pg_size_pretty(SUM(CASE WHEN town = 'BOSTON' THEN st_mem_size(the_geom) ELSE 0 END)) As bossum, -CAST(SUM(CASE WHEN town = 'BOSTON' THEN st_mem_size(the_geom) ELSE 0 END)*1.00 / - SUM(st_mem_size(the_geom))*100 As numeric(10,2)) As perbos +SELECT pg_size_pretty(SUM(ST_MemSize(the_geom))) as totgeomsum, +pg_size_pretty(SUM(CASE WHEN town = 'BOSTON' THEN ST_MemSize(the_geom) ELSE 0 END)) As bossum, +CAST(SUM(CASE WHEN town = 'BOSTON' THEN ST_MemSize(the_geom) ELSE 0 END)*1.00 / + SUM(ST_MemSize(the_geom))*100 As numeric(10,2)) As perbos FROM towns; totgeomsum bossum perbos @@ -577,14 +579,14 @@ totgeomsum bossum perbos 1522 kB 30 kB 1.99 -SELECT ST_Mem_Size(ST_GeomFromText('CIRCULARSTRING(220268 150415,220227 150505,220227 150406)')); +SELECT ST_MemSize(ST_GeomFromText('CIRCULARSTRING(220268 150415,220227 150505,220227 150406)')); --- 73 --What percentage of our table is taken up by just the geometry -SELECT pg_total_relation_size('public.neighborhoods') As fulltable_size, sum(ST_Mem_Size(the_geom)) As geomsize, -sum(ST_Mem_Size(the_geom))*1.00/pg_total_relation_size('public.neighborhoods')*100 As pergeom +SELECT pg_total_relation_size('public.neighborhoods') As fulltable_size, sum(ST_MemSize(the_geom)) As geomsize, +sum(ST_MemSize(the_geom))*1.00/pg_total_relation_size('public.neighborhoods')*100 As pergeom FROM neighborhoods; fulltable_size geomsize pergeom ------------------------------------------------ diff --git a/doc/reference_raster.xml b/doc/reference_raster.xml index 4dc25acc0..bf2ef4b67 100644 --- a/doc/reference_raster.xml +++ b/doc/reference_raster.xml @@ -2169,6 +2169,56 @@ t | + + + ST_MemSize + + Returns the amount of space (in bytes) the raster takes. + + + + + + integer ST_MemSize + raster rast + + + + + + Description + + Returns the amount of space (in bytes) the raster takes. + This is a nice compliment to PostgreSQL built in functions pg_column_siez, pg_size_pretty, pg_relation_size, pg_total_relation_size. + pg_relation_size which gives the byte size of a table may return byte size lower than ST_MemSize. This is because + pg_relation_size does not add toasted table contribution and large geometries are stored in TOAST tables. pg_column_size might return lower because it returns the compressed size. + pg_total_relation_size - includes, the table, the toasted tables, and the indexes. + + + Availability: 2.2.0 + + + + + Examples + + + SELECT ST_MemSize(ST_AsRaster(ST_Buffer(ST_Point(1,5),10,1000),150, 150, '8BUI')) As rast_mem; + + rast_mem + -------- + 22568 + + + + + + See Also + + + + + ST_MetaData