ST_MemSize — Returns the amount of space (in bytes) the raster takes.
Returns the amount of space (in bytes) the raster takes.
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_column_size might return lower because it returns the compressed size.
pg_total_relation_size - includes, the table, the toasted tables, and the indexes.
SELECT ST_MemSize(ST_AsRaster(ST_Buffer(ST_Point(1,5),10,1000),150, 150, '8BUI')) As rast_mem; rast_mem -------- 22568