select segment_name, GB from
(select segment_name, round(sum(bytes)/1024/1024/1024, 1) GB from dba_segments group by segment_name order by 2 desc)
where GB >= 1;
SEGMENT_NAME GB
--------------------------------------------------------------------------------- ----------
AUD$ 23,7
FFMAPREP 7,5
SMLOG 5,5
SMSPEC 4
SMPOSTFAILOUTVP 3,9
SMPOSTFAILRP 3,8
SMDISCQUANTITYLOG 3,6
FFSPEC 3,3
SMPOSTFAILRPDATA 2,8
SMTIMESPANSALE 2,6
SMSPEC_ART 2,4
SMCTIMESPANSALE_PK 2,3
SMCSPEC_DISPLAYPOS 2,2
SMCSPECTAX_PK 2,1
SMCSPEC_PK 2,1
SMSPECTAX 2
FFMAPREP_DOC 1,8
SMSPECSTAT 1,7
FFMAPREP_INCOMEDOC 1,6
SMCSPECSTAT_PK 1,4
FFMAPREP_LOCFROM 1,3
FFMAPREP_LOCTO 1,3
SMCDISCQUANTITYLOG_PK 1,3
SMSPEC_ARTICLE_IND 1,3
FFSPEC_ART 1,3
REPORT_RESTS_CURRENT 1,2
SMCASHCHECKITEMS 1,1
FFMAPREP_SALEDATE 1,1
SMTIMESPANSALE_ART 1
FFCSPEC_PK 1
SMPOSTOUTLOG 1
FFMAPREP_ARTICLE 1
SMDISCQUANTITYLOG_ARTIDX 1
select loc, count(distinct id), count(1)
from (
select nvl(h.locationto, nvl(h.locationfrom, h.location)) loc, h.id
from smdocuments h, smspec s
where h.doctype = s.doctype
and h.id = s.docid
and nvl(h.locationto, nvl(h.locationfrom, h.location)) in (3,4,5,6)
)
group by loc;
5 61020 4649945
6 51283 993129
4 73602 5151253
3 90065 4655882
-- расчет остатков location = 3
Затрач.время: 00:04:43.65