-----------------------------------------------------------------------
SELECT 'ms1', ST_MemSize(ST_MakeEmptyRaster(10, 10, 0, 0, 1, -1, 0, 0, 0));
-SELECT 'ms2', ST_MemSize(rast) from raster_outdb_template order by rid;
+WITH
+mem AS (
+ SELECT rid, ST_MemSize(rast) as size from raster_outdb_template
+),
+path AS (
+ SELECT rid, sum(length(st_bandpath(rast,n))) as len,
+ array_agg(st_bandpath(rast,n)) as agg
+ FROM raster_outdb_template, generate_series(1,ST_NumBands(rast)) n
+ GROUP BY rid
+)
+SELECT 'ms2', mem.rid, mem.size - path.len
+ from mem, path
+ where mem.rid = path.rid
+ order by mem.rid;
-----------------------------------------------------------------------
-- st_bandpath()
band 1 of pixtype 8BUI is out-db with NODATA value of 255
band 2 of pixtype 8BUI is in-db with NODATA value of 0
ms1|64
-ms2|280
-ms2|280
-ms2|8240
-ms2|8240
+ms2|1|82
+ms2|2|82
+ms2|3|8174
+ms2|4|8174
NOTICE: Could not find raster band of index 1 when getting band path. Returning NULL
bandpath1|
bandpath2|testraster.tif