Professional Documents
Culture Documents
1 Manual
263 / 315
Synopsis
integer ST_Mem_Size(geometry geomA);
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.
Note
pg_relation_size which gives the byte size of a table may return byte size lower than ST_Mem_Size. 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.
Examples
--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
FROM towns;
--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
FROM neighborhoods;
fulltable_size geomsize pergeom
-----------------------------------------------262144
96238
36.71188354492187500000
See Also
7.12.10 ST_Point_Inside_Circle
Name
ST_Point_Inside_Circle Is the point geometry insert circle defined by center_x, center_y , radius
Synopsis
boolean ST_Point_Inside_Circle(geometry a_point, float center_x, float center_y, float radius);
Description
The syntax for this functions is point_inside_circle(<geometry>,<circle_center_x>,<circle_center_y>,<radius>). Returns the
true if the geometry is a point and is inside the circle. Returns false otherwise.
Examples
SELECT ST_Point_Inside_Circle(ST_Point(1,2), 0.5, 2, 3);
st_point_inside_circle
-----------------------t
See Also
ST_DWithin
7.12.11 ST_XMax
Name
ST_XMax Returns X maxima of a bounding box 2d or 3d or a geometry.
Synopsis
float ST_XMax(box3d aGeomorBox2DorBox3D);