Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#2770 closed enhancement (fixed)

Implement ST_MemSize(raster)

Reported by: strk Owned by: strk
Priority: medium Milestone: PostGIS 2.2.0
Component: raster Version: master
Keywords: history Cc:


To go togheter with ST_MemSize(geometry) — and see #2769

Change History (8)

comment:1 by strk, 10 years ago

Committed as r12630 — but I hadn't added documentation. Can you help with that robe ? I'd just point it to the geometry version…

comment:2 by strk, 10 years ago

Keywords: history added
Milestone: PostGIS 2.2.0
Owner: changed from pramsey to strk
Status: newassigned
Type: defectenhancement
Version: 2.1.xtrunk

comment:3 by strk, 10 years ago

Component: postgisraster

comment:4 by strk, 10 years ago

Tests for the new function seem to be unstable, see #2771

comment:5 by robe, 10 years ago


comment:6 by robe, 10 years ago

strk and dustymugs,

Why is the raster mem size so different from pg_column_size. Might be a bug in pg_column_size or we changed something recently in how we are storing things. For example:

SELECT ST_MemSize(ST_AsRaster(ST_Buffer(ST_Point(1,5),10,1000),150, 150, '8BUI')) As mem_rast_size, pg_column_size(ST_MemSize(ST_AsRaster(ST_Buffer(ST_Point(1,5),10,1000),150, 150, '8BUI'))) As col_rast_size
, ST_MemSize(ST_Buffer(ST_Point(1,5),10,1000)) As mem_geom_size, pg_column_size(ST_Buffer(ST_Point(1,5),10,1000)) As col_geom_size;


mem_rast_size | col_rast_size | mem_geom_size | col_geom_size

22568 | 4 | 64072 | 64072

I checked the manual and it does say

as I remember pg_column_size — Number of bytes used to store a particular value (possibly compressed)

is compression for this case really that good. I guess its possible since it is a fairly simple rasterized geometry.

I did a quick test on one of my production PostGIS 2.1.2 installs and:

SELECT pg_column_size(ST_AsRaster(ST_Buffer(ST_Point(1,5),10,1000),150, 150, '8BUI'));



So unless we changed something recently in how we are storing something seems a bit fishy.

comment:7 by robe, 10 years ago

Resolution: fixed
Status: assignedclosed

update docs at r12534. I'm going to close this out and open up the pg_column_size discrepancy as a separate ticket which dustymugs can swiftly close if he feels this is an expected change.

comment:8 by robe, 10 years ago

nevermind my diatribe, I just realized I had a typo in my example and pg_column_size and ST_MemSize do return the same answer for raster. I had a typo pg_column_size(ST_MemSize…) doh.

Note: See TracTickets for help on using tickets.