Цитата: SELECT a.taxgroupid, DECODE (o.expensetype, 1, 1, 2) oper_type, o.ID operid,
NVL (u.ID, -2) useroperid, o.NAME || ' ' || u.title opername,
m.saletype, m.salepaycash,
SUM (DECODE (m.saleq, 0, 0, m.salesum * m.quantity / m.saleq)
) sum_full,
SUM (DECODE (m.incomeq,
0, 0,
m.incomenovat * m.quantity / m.incomeq
)
) cp,
SUM (DECODE (m.incomeq, 0, 0, m.incomesum * m.quantity / m.incomeq)
) cp_full
FROM supermag.fvmaprep m,
supermag.smcardtax a,
supermag.saoperation o,
supermag.smuserop u
WHERE o.ID IN (1, 3)
AND m.saleop = o.ID
AND m.saleuserop = u.ID(+)
AND m.saletype IN ('CI', 'CS', 'WO', 'CI', 'CR', 'WI')
AND m.saleop IN (1, 3)
AND m.saledate BETWEEN TO_DATE ('01.01.2006', 'DD.MM.YYYY')
AND TO_DATE ('31.03.2006', 'DD.MM.YYYY')
AND NVL (m.salelocationfrom, m.salelocationto) = 12
AND a.article = m.article
AND TO_DATE ('31.03.2006', 'DD.MM.YYYY') BETWEEN a.datefrom AND a.dateto
GROUP BY a.taxgroupid,
DECODE (o.expensetype, 1, 1, 2),
o.ID,
NVL (u.ID, -2),
o.NAME || ' ' || u.title,
m.saletype,
m.salepaycash
ORDER BY 1 ASC, 5 ASC, 3 ASC, 2 ASC, 4 ASC, 7 ASC, 6 ASC
------------------------------------------------------------
Statement Id=1442592 Type=
Cost=2,64013623522001E-308 TimeStamp=15-11-07::08::08:37
(1) SELECT STATEMENT CHOOSE
Est. Rows: 1 Cost: 379
(16) SORT GROUP BY
Est. Rows: 1 Cost: 379
(15) NESTED LOOPS OUTER
Est. Rows: 1 Cost: 377
(12) NESTED LOOPS
Est. Rows: 1 Cost: 376
(9) NESTED LOOPS
Est. Rows: 1 Cost: 375
(2) TABLE ACCESS FULL SUPERMAG.SMCARDTAX [Analyzed]
(2) Blocks: 180 Est. Rows: 36 878 of 36 878 Cost: 6
Tablespace: USERS
(8) VIEW (Embedded SQL)
Est. Rows: 1 Cost: 1
(7) UNION-ALL PARTITION
(4) TABLE ACCESS BY INDEX ROWID SUPERMAG.FFMAPREP [Analyzed]
(4) Blocks: 76 498 Est. Rows: 1 of 15 805 517 Cost: 152 371
Tablespace: BIG_USERS
(3) NON-UNIQUE INDEX FULL SCAN SUPERMAG.FFMAPREP_DOC [Analyzed]
Est. Rows: 15 805 517 Cost: 16 831
(6) TABLE ACCESS BY INDEX ROWID SUPERMAG.FFMAPREP_ [Analyzed]
(6) Est. Rows: 1 Cost: 1
Tablespace: USERS
(5) NON-UNIQUE INDEX RANGE SCAN SUPERMAG.FFMAPREP_ARTICLE_ [Analyzed]
Est. Rows: 1 Cost: 1
(11) TABLE ACCESS BY INDEX ROWID SUPERMAG.SAOPERATION [Analyzed]
(11) Blocks: 4 Est. Rows: 1 of 32 Cost: 1
Tablespace: USERS
(10) UNIQUE INDEX UNIQUE SCAN SUPERMAG.SACOPERATION_PK [Analyzed]
Est. Rows: 1
(14) TABLE ACCESS BY INDEX ROWID SUPERMAG.SMUSEROP [Analyzed]
(14) Blocks: 4 Est. Rows: 1 of 2 Cost: 1
Tablespace: USERS
(13) UNIQUE INDEX UNIQUE SCAN SUPERMAG.SMCUSEROP_PK [Analyzed]
Est. Rows: 1
Никак не могу избавиться от фулскана в отчете, дальше повесился... Есть идеи? Убился уже. С подсказкой использует индекс, index_cost_adj=1... Есть идеи? Доберусь до работы - буду трейс снимать... :(
Цитата: SELECT /*+INDEX(a SMCCARDTAX_PK)*/a.taxgroupid, DECODE (o.expensetype, 1, 1, 2) oper_type, o.ID operid,
NVL (u.ID, -2) useroperid, o.NAME || ' ' || u.title opername,
m.saletype, m.salepaycash,
SUM (DECODE (m.saleq, 0, 0, m.salesum * m.quantity / m.saleq)
) sum_full,
SUM (DECODE (m.incomeq,
0, 0,
m.incomenovat * m.quantity / m.incomeq
)
) cp,
SUM (DECODE (m.incomeq, 0, 0, m.incomesum * m.quantity / m.incomeq)
) cp_full
FROM supermag.fvmaprep m,
supermag.smcardtax a,
supermag.saoperation o,
supermag.smuserop u
WHERE o.ID IN (1, 3)
AND m.saleop = o.ID
AND m.saleuserop = u.ID(+)
AND m.saletype IN ('CI', 'CS', 'WO', 'CI', 'CR', 'WI')
AND m.saleop IN (1, 3)
AND m.saledate BETWEEN TO_DATE ('01.01.2006', 'DD.MM.YYYY')
AND TO_DATE ('31.03.2006', 'DD.MM.YYYY')
AND NVL (m.salelocationfrom, m.salelocationto) = 12
AND a.article = m.article
AND TO_DATE ('31.03.2006', 'DD.MM.YYYY') BETWEEN a.datefrom AND a.dateto
GROUP BY a.taxgroupid,
DECODE (o.expensetype, 1, 1, 2),
o.ID,
NVL (u.ID, -2),
o.NAME || ' ' || u.title,
m.saletype,
m.salepaycash
ORDER BY 1 ASC, 5 ASC, 3 ASC, 2 ASC, 4 ASC, 7 ASC, 6 ASC
------------------------------------------------------------
Statement Id=1442592 Type=
Cost=2,64013623522001E-308 TimeStamp=15-11-07::08::12:51
(1) SELECT STATEMENT CHOOSE
Est. Rows: 1 Cost: 469
(17) SORT GROUP BY
Est. Rows: 1 Cost: 469
(16) NESTED LOOPS OUTER
Est. Rows: 1 Cost: 467
(13) NESTED LOOPS
Est. Rows: 1 Cost: 466
(10) NESTED LOOPS
Est. Rows: 1 Cost: 465
(3) TABLE ACCESS BY INDEX ROWID SUPERMAG.SMCARDTAX [Analyzed]
(3) Blocks: 180 Est. Rows: 36 878 of 36 878 Cost: 96
Tablespace: USERS
(2) UNIQUE INDEX FULL SCAN SUPERMAG.SMCCARDTAX_PK [Analyzed]
Est. Rows: 36 878 Cost: 302
(9) VIEW (Embedded SQL)
Est. Rows: 1 Cost: 1
(8) UNION-ALL PARTITION
(5) TABLE ACCESS BY INDEX ROWID SUPERMAG.FFMAPREP [Analyzed]
(5) Blocks: 76 498 Est. Rows: 1 of 15 805 517 Cost: 152 371
Tablespace: BIG_USERS
(4) NON-UNIQUE INDEX FULL SCAN SUPERMAG.FFMAPREP_DOC [Analyzed]
Est. Rows: 15 805 517 Cost: 16 831
(7) TABLE ACCESS BY INDEX ROWID SUPERMAG.FFMAPREP_ [Analyzed]
(7) Est. Rows: 1 Cost: 1
Tablespace: USERS
(6) NON-UNIQUE INDEX RANGE SCAN SUPERMAG.FFMAPREP_ARTICLE_ [Analyzed]
Est. Rows: 1 Cost: 1
(12) TABLE ACCESS BY INDEX ROWID SUPERMAG.SAOPERATION [Analyzed]
(12) Blocks: 4 Est. Rows: 1 of 32 Cost: 1
Tablespace: USERS
(11) UNIQUE INDEX UNIQUE SCAN SUPERMAG.SACOPERATION_PK [Analyzed]
Est. Rows: 1
(15) TABLE ACCESS BY INDEX ROWID SUPERMAG.SMUSEROP [Analyzed]
(15) Blocks: 4 Est. Rows: 1 of 2 Cost: 1
Tablespace: USERS
(14) UNIQUE INDEX UNIQUE SCAN SUPERMAG.SMCUSEROP_PK [Analyzed]
Est. Rows: 1