Temporary tables size

SELECT dbname,
allocated_tbytes,
allocated_gbytes,
used_tbytes,
used_gbytes,
SUM(allocated_tbytes)OVER() total_allocated_tbytes,
SUM(allocated_gbytes)OVER() total_allocated_gbytes,
SUM(allocated_tbytes)OVER() total_used_tbytes,
SUM(allocated_gbytes)OVER() total_used_gbytes
FROM (SELECT sod.dbname,
SUM(soss.allocated_bytes)/1024/1024/1024/1024 allocated_tbytes,
SUM(soss.allocated_bytes)/1024/1024/1024 allocated_gbytes,
SUM(soss.used_bytes)/1024/1024/1024/1024 used_tbytes,
SUM(soss.used_bytes)/1024/1024/1024 used_gbytes
FROM _v_sys_object_data sod
INNER JOIN _v_sys_object_storage_size soss ON sod.objid = soss.tblid
AND sod.objtype = UPPER(‘TEMP TABLE’)
INNER JOIN _v_sys_database d ON sod.dbname = d.objname
GROUP BY sod.dbname
) t