select tn.partnum , tn.dbsname , (pt.nptotal * pt.pagesize) /1024 as total_kb , (pt.npused * pt.pagesize) /1024 as used_kb , (pt.npused * pt.pagesize) / 1024 /1024/1024 as used_gb , (pt.npdata * pt.pagesize) /1024 as data_kb , tn.owner , tn.tabname , pt.lockid, pt.flags, pt.flags2 , pt.rowsize, pt.ncols, pt.pagesize , dbinfo('utc_to_datetime',pt.created) as created , pt.nrows, pt.nptotal, pt.npused, pt.npdata , pt.nrows * pt.rowsize as tamanho_bytes , ((pt.nptotal - pt.npused) * pt.pagesize) /1024 as free_kb , pt.nextns as extents , pt.ninserts , pt.nupdates , pt.ndeletes , coalesce(pt.serialv,pt.cur_serial8,pt.cur_bigserial)::bigint serial , pta_oldvers , pta_newvers from sysmaster:sysptnhdr pt left join sysmaster:systabnames tn on tn.partnum = pt.partnum where dbsname = 'tablename' order by used_kb desc
Kaynak: