</refsection>
</refentry>
- <refentry id="ST_Mem_Size">
+ <refentry id="ST_MemSize">
<refnamediv>
- <refname>ST_Mem_Size</refname>
+ <refname>ST_MemSize</refname>
<refpurpose>Returns the amount of space (in bytes) the geometry takes.</refpurpose>
</refnamediv>
<refsynopsisdiv>
<funcsynopsis>
<funcprototype>
- <funcdef>integer <function>ST_Mem_Size</function></funcdef>
+ <funcdef>integer <function>ST_MemSize</function></funcdef>
<paramdef><type>geometry </type> <parameter>geomA</parameter></paramdef>
</funcprototype>
</funcsynopsis>
<title>Description</title>
<para>Returns the amount of space (in bytes) the geometry takes. </para>
- <para>This is a nice compliment to PostgreSQL built in functions pg_size_pretty, pg_relation_size, pg_total_relation_size.</para>
- <note><para>pg_relation_size which gives the byte size of a table may return byte size lower than ST_Mem_Size. This is because
+ <para>This is a nice compliment to PostgreSQL built in functions pg_column_size, pg_size_pretty, pg_relation_size, pg_total_relation_size.</para>
+ <note><para>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.</para>
<para>pg_total_relation_size - includes, the table, the toasted tables, and the indexes.</para>
+ <para>pg_column_size returns how much space a geometry would take in a column considering compression, so may be lower than ST_MemSize</para>
</note>
<para>&Z_support;</para>
<para>&curve_support;</para>
<para>&P_support;</para>
<para>&T_support;</para>
+ <para>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.</para>
</refsection>
<programlisting>
--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
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
------------------------------------------------
</refsection>
</refentry>
+ <refentry id="RT_ST_MemSize">
+ <refnamediv>
+ <refname>ST_MemSize</refname>
+
+ <refpurpose>Returns the amount of space (in bytes) the raster takes.</refpurpose>
+ </refnamediv>
+
+ <refsynopsisdiv>
+ <funcsynopsis>
+ <funcprototype>
+ <funcdef>integer <function>ST_MemSize</function></funcdef>
+ <paramdef><type>raster </type> <parameter>rast</parameter></paramdef>
+ </funcprototype>
+ </funcsynopsis>
+ </refsynopsisdiv>
+
+ <refsection>
+ <title>Description</title>
+
+ <para>Returns the amount of space (in bytes) the raster takes. </para>
+ <para>This is a nice compliment to PostgreSQL built in functions pg_column_siez, pg_size_pretty, pg_relation_size, pg_total_relation_size.</para>
+ <note><para>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.</para>
+ <para>pg_total_relation_size - includes, the table, the toasted tables, and the indexes.</para>
+ </note>
+
+ <para>Availability: 2.2.0</para>
+ </refsection>
+
+
+ <refsection>
+ <title>Examples</title>
+
+ <programlisting>
+ SELECT ST_MemSize(ST_AsRaster(ST_Buffer(ST_Point(1,5),10,1000),150, 150, '8BUI')) As rast_mem;
+
+ rast_mem
+ --------
+ 22568
+ </programlisting>
+ </refsection>
+
+ <!-- Optionally add a "See Also" section -->
+ <refsection>
+ <title>See Also</title>
+
+ <para></para>
+ </refsection>
+ </refentry>
+
<refentry id="RT_ST_MetaData">
<refnamediv>
<refname>ST_MetaData</refname>