ST_MemSize — 返回几何体占用的内存空间量。
integer ST_MemSize(
geometry geomA)
;
返回几何体占用的内存空间量(以字节为单位)。
这是对PostgreSQL内置功能的补充 数据库对象函数 PG_Column_Size、PG_Size_Pretty、PG_Relationship_Size、PG_Total_Relationship_Size。
给出表的字节大小的PG_Relationship_SIZE可能返回小于ST_MemSize的字节大小。这是因为PG_Relationship_SIZE不添加烤面包表贡献,并且大几何图形存储在烤面包表中。 PG_TOTAL_RELATION_SIZE-包括、表、烤面包表和索引。 PG_COLUMN_SIZE返回考虑压缩后几何在列中所占的空间量,因此可能低于ST_MemSize |
This function supports 3d and will not drop the z-index.
This method supports Circular Strings and Curves
This function supports Polyhedral surfaces.
This function supports Triangles and Triangulated Irregular Network Surfaces (TIN).
已更改:2.2.0名称更改为ST_MemSize以遵循命名约定。
--Return how much byte space Boston takes up in our Mass data set SELECT pg_size_pretty(SUM(ST_MemSize(geom))) as totgeomsum, pg_size_pretty(SUM(CASE WHEN town = 'BOSTON' THEN ST_MemSize(geom) ELSE 0 END)) As bossum, CAST(SUM(CASE WHEN town = 'BOSTON' THEN ST_MemSize(geom) ELSE 0 END)*1.00 / SUM(ST_MemSize(geom))*100 As numeric(10,2)) As perbos FROM towns; totgeomsum bossum perbos ---------- ------ ------ 1522 kB 30 kB 1.99 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_MemSize(geom)) As geomsize, sum(ST_MemSize(geom))*1.00/pg_total_relation_size('public.neighborhoods')*100 As pergeom FROM neighborhoods; fulltable_size geomsize pergeom ------------------------------------------------ 262144 96238 36.71188354492187500000