SQL*Plus: Release 11.2.0.3.0 Production on Wed Sep 25 00:03:36 2013
Copyright (c) 1982, 2011, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, Automatic Storage Management, OLAP, Data Mining
and Real Application Testing options
SQL> set timing on
SQL> set linesize 177
SQL> set
SQL>
SQL>
SQL> insert into tmp1060 (BillNumber)
2 Select BillNumber
3 From "xxx".tb201309_ConGoodsBill
4 Where ExecuteDate='20130924';
16956 rows created.
Elapsed: 00:00:00.11
SQL> set autotrace traceonly
SQL> SELECT GS.*
2 From "xxx".tbdgs GS , (Select Coalesce(JT.GoodsCode,FL.GoodsCode) GoodsCode
3 From
4 (
5 Select E.GoodsCode,G.BILLNUMBER,G.MAINGOODSID,G.INSIDEID,G.DEPTTYPE,G.CATEGORYITEMCODE,G.DEPTCODE,G.PRICEMODE,G.PURCHPRICE,G.WITHHOLDINGRATES,G.MAXPURCHPRICE,G.RATE,G.SUPPLYGOODSTIME,G.COUNTERCODE,G.PRICECOMPENSATYPE,G.YPRICEMODE,G.YPURCHPRICE,G.YWITHHOLDINGRATES,G.YHIGHPURCHPRICE,G.SGSUPPLIERRATE,G.VIPSUPPLIERRATE,G.TEMPBEGINDATE,G.TEMPENDDATE,G.TEMPRATE
6 From
7 (select m.BillNumber from "xxx".TB201308_ConGoodsBill M,tmp1060 t where t.BillNumber=m.BillNumber and M.ExecuteDate = '20130924') M,
8 (select G.BILLNUMBER,
9 G.MAINGOODSID,
10 G.INSIDEID,
11 G.DEPTTYPE,
12 G.CATEGORYITEMCODE,
13 G.DEPTCODE,
14 G.PRICEMODE,
15 G.PURCHPRICE,
16 G.WITHHOLDINGRATES,
17 G.MAXPURCHPRICE,
18 G.RATE,
19 G.SUPPLYGOODSTIME,
20 G.COUNTERCODE,
21 G.PRICECOMPENSATYPE,
22 G.YPRICEMODE,
23 G.YPURCHPRICE,
24 G.YWITHHOLDINGRATES,
25 G.YHIGHPURCHPRICE,
26 G.SGSUPPLIERRATE,G.VIPSUPPLIERRATE,
27 G.TempBeginDate,
28 G.TempEndDate,
29 G.TempRate
30 from "xxx".TB201308_DeptConGoods G where G.DeptType = 1 AND G.DeptCode = '1329') G,
31 "xxx".TB201308_ConGoodsDetail E
32 Where M.BillNumber = G.BillNumber
33 And M.BillNumber = E.BillNumber
34 And G.MainGoodsID = E.InsideID
35 ) JT Full Join
36 (
37 Select /*+ index(G IDX_09$DEPTCODE) index(E PK_TB201309_CONGOODSDETAIL) */ E.GoodsCode,G.BILLNUMBER,G.MAINGOODSID,G.INSIDEID,G.DEPTTYPE,G.CATEGORYITEMCODE,G.DEPTCODE,G.PRICEMODE,G.PURCHPRICE,G.WITHHOLDINGRATES,G.MAXPURCHPRICE,G.RATE,G.SUPPLYGOODSTIME,G.COUNTERCODE,G.PRICECOMPENSATYPE,G.YPRICEMODE,G.YPURCHPRICE,G.YWITHHOLDINGRATES,G.YHIGHPURCHPRICE,G.SGSUPPLIERRATE,G.VIPSUPPLIERRATE,G.TEMPBEGINDATE,G.TEMPENDDATE,G.TEMPRATE
38 From
39 ( select m.BillNumber from "xxx".TB201308_ConGoodsBill M,tmp1060 T where m.BillNumber=t.BillNumber AND M.ExecuteDate = '20130924' ) M,
40 "xxx".TB201308_DeptConGoods G ,
41 "xxx".tbCatToDepartment D ,
42 "xxx".TB201308_ConGoodsDetail E
43 Where M.BillNumber = G.BillNumber
44 And M.BillNumber = E.BillNumber
45 And G.DeptType = 0
46 And D.NodeCode = '1329'
47 And G.CategoryItemCode = D.DeptCatItemCode
48 And G.DeptCode = D.DeptCategoryCode
49 And G.MainGoodsID = E.InsideID
50 ) FL On JT.BillNumber = FL.BillNumber And JT.DeptCode = FL.DeptCode And JT.GoodsCode = FL.GoodsCode Union All Select Coalesce(JT.GoodsCode,FL.GoodsCode) GoodsCode
51 From
52 (
53 Select E.GoodsCode,G.BILLNUMBER,G.MAINGOODSID,G.INSIDEID,G.DEPTTYPE,G.CATEGORYITEMCODE,G.DEPTCODE,G.PRICEMODE,G.PURCHPRICE,G.WITHHOLDINGRATES,G.MAXPURCHPRICE,G.RATE,G.SUPPLYGOODSTIME,G.COUNTERCODE,G.PRICECOMPENSATYPE,G.YPRICEMODE,G.YPURCHPRICE,G.YWITHHOLDINGRATES,G.YHIGHPURCHPRICE,G.SGSUPPLIERRATE,G.VIPSUPPLIERRATE,G.TEMPBEGINDATE,G.TEMPENDDATE,G.TEMPRATE
54 From
55 (select m.BillNumber from "xxx".TB201309_ConGoodsBill M,tmp1060 t where t.BillNumber=m.BillNumber and M.ExecuteDate = '20130924') M,
56 (select G.BILLNUMBER,
57 G.MAINGOODSID,
58 G.INSIDEID,
59 G.DEPTTYPE,
60 G.CATEGORYITEMCODE,
61 G.DEPTCODE,
62 G.PRICEMODE,
63 G.PURCHPRICE,
64 G.WITHHOLDINGRATES,
65 G.MAXPURCHPRICE,
66 G.RATE,
67 G.SUPPLYGOODSTIME,
68 G.COUNTERCODE,
69 G.PRICECOMPENSATYPE,
70 G.YPRICEMODE,
71 G.YPURCHPRICE,
72 G.YWITHHOLDINGRATES,
73 G.YHIGHPURCHPRICE,
74 G.SGSUPPLIERRATE,G.VIPSUPPLIERRATE,
75 G.TempBeginDate,
76 G.TempEndDate,
77 G.TempRate
78 from "xxx".TB201309_DeptConGoods G where G.DeptType = 1 AND G.DeptCode = '1329') G,
79 "xxx".TB201309_ConGoodsDetail E
80 Where M.BillNumber = G.BillNumber
81 And M.BillNumber = E.BillNumber
82 And G.MainGoodsID = E.InsideID
83 ) JT Full Join
84 (
85 Select /*+ index(G IDX_09$DEPTCODE) index(E PK_TB201309_CONGOODSDETAIL) */ E.GoodsCode,G.BILLNUMBER,G.MAINGOODSID,G.INSIDEID,G.DEPTTYPE,G.CATEGORYITEMCODE,G.DEPTCODE,G.PRICEMODE,G.PURCHPRICE,G.WITHHOLDINGRATES,G.MAXPURCHPRICE,G.RATE,G.SUPPLYGOODSTIME,G.COUNTERCODE,G.PRICECOMPENSATYPE,G.YPRICEMODE,G.YPURCHPRICE,G.YWITHHOLDINGRATES,G.YHIGHPURCHPRICE,G.SGSUPPLIERRATE,G.VIPSUPPLIERRATE,G.TEMPBEGINDATE,G.TEMPENDDATE,G.TEMPRATE
86 From
87 ( select m.BillNumber from "xxx".TB201309_ConGoodsBill M,tmp1060 T where m.BillNumber=t.BillNumber AND M.ExecuteDate = '20130924' ) M,
88 "xxx".TB201309_DeptConGoods G ,
89 "xxx".tbCatToDepartment D ,
90 "xxx".TB201309_ConGoodsDetail E
91 Where M.BillNumber = G.BillNumber
92 And M.BillNumber = E.BillNumber
93 And G.DeptType = 0
94 And D.NodeCode = '1329'
95 And G.CategoryItemCode = D.DeptCatItemCode
96 And G.DeptCode = D.DeptCategoryCode
97 And G.MainGoodsID = E.InsideID
98 ) FL On JT.BillNumber = FL.BillNumber And JT.DeptCode = FL.DeptCode And JT.GoodsCode = FL.GoodsCode ) GCON
99 Where exists (select 1 from (select 0 DeptType,DeptCategoryCode DeptCode from "xxx".tbCatToDepartment where NodeCode = '1329' and DeptCatItemCode = '0004'
100 union all
101 select 1 DeptType,'1329' DeptCode from dual) depts
102 where GS.DeptCode = depts.DeptCode and GS.DeptType = depts.DeptType
103 )
104 And GS.GoodsCode = GCON.GoodsCode;
287 rows selected.
Elapsed: 00:09:45.14
Execution Plan
----------------------------------------------------------
Plan hash value: 1794864797
----------------------------------------------------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
----------------------------------------------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 59 | 4838 | 60367 (1)| 00:12:05 |
|* 1 | HASH JOIN | | 59 | 4838 | 60367 (1)| 00:12:05 |
| 2 | VIEW | | 1256 | 11304 | 55113 (1)| 00:11:02 |
| 3 | UNION-ALL | | | | | |
| 4 | VIEW | VW_FOJ_0 | 4 | 72 | 204 (1)| 00:00:03 |
|* 5 | HASH JOIN FULL OUTER | | 4 | 232 | 204 (1)| 00:00:03 |
| 6 | VIEW | | 1 | 29 | 82 (2)| 00:00:01 |
|* 7 | HASH JOIN | | 1 | 128 | 82 (2)| 00:00:01 |
| 8 | NESTED LOOPS | | | | | |
| 9 | NESTED LOOPS | | 1 | 116 | 63 (0)| 00:00:01 |
| 10 | NESTED LOOPS | | 3 | 246 | 57 (0)| 00:00:01 |
| 11 | NESTED LOOPS | | 716 | 47972 | 57 (0)| 00:00:01 |
| 12 | TABLE ACCESS BY INDEX ROWID | TB201308_CONGOODSBILL | 23 | 667 | 4 (0)| 00:00:01 |
|* 13 | INDEX RANGE SCAN | IDX_201308EXECUTEDATE | 23 | | 3 (0)| 00:00:01 |
|* 14 | TABLE ACCESS BY INDEX ROWID | TB201308_DEPTCONGOODS | 31 | 1178 | 5 (0)| 00:00:01 |
|* 15 | INDEX RANGE SCAN | IDX201308DEPTCONGOODS | 57 | | 2 (0)| 00:00:01 |
|* 16 | INDEX UNIQUE SCAN | PK_TBCATTODEPARTMENT | 1 | 15 | 0 (0)| 00:00:01 |
|* 17 | INDEX UNIQUE SCAN | PK_TB201308_CONGOODSDETAIL | 1 | | 1 (0)| 00:00:01 |
| 18 | TABLE ACCESS BY INDEX ROWID | TB201308_CONGOODSDETAIL | 1 | 34 | 2 (0)| 00:00:01 |
| 19 | TABLE ACCESS FULL | tmp1060 | 16956 | 198K| 18 (0)| 00:00:01 |
| 20 | VIEW | | 4 | 116 | 122 (1)| 00:00:02 |
|* 21 | HASH JOIN | | 4 | 436 | 122 (1)| 00:00:02 |
| 22 | NESTED LOOPS | | | | | |
| 23 | NESTED LOOPS | | 4 | 388 | 103 (0)| 00:00:02 |
| 24 | NESTED LOOPS | | 23 | 1449 | 57 (0)| 00:00:01 |
| 25 | TABLE ACCESS BY INDEX ROWID | TB201308_CONGOODSBILL | 23 | 667 | 4 (0)| 00:00:01 |
|* 26 | INDEX RANGE SCAN | IDX_201308EXECUTEDATE | 23 | | 3 (0)| 00:00:01 |
|* 27 | TABLE ACCESS BY INDEX ROWID | TB201308_DEPTCONGOODS | 1 | 34 | 5 (0)| 00:00:01 |
|* 28 | INDEX RANGE SCAN | IDX201308DEPTCONGOODS | 57 | | 2 (0)| 00:00:01 |
|* 29 | INDEX UNIQUE SCAN | PK_TB201308_CONGOODSDETAIL | 1 | | 1 (0)| 00:00:01 |
| 30 | TABLE ACCESS BY INDEX ROWID | TB201308_CONGOODSDETAIL | 1 | 34 | 2 (0)| 00:00:01 |
| 31 | TABLE ACCESS FULL | tmp1060 | 16956 | 198K| 18 (0)| 00:00:01 |
| 32 | VIEW | VW_FOJ_1 | 1252 | 22536 | 54909 (1)| 00:10:59 |
|* 33 | HASH JOIN FULL OUTER | | 1252 | 72616 | 54909 (1)| 00:10:59 |
| 34 | VIEW | | 104 | 3016 | 3387 (1)| 00:00:41 |
| 35 | NESTED LOOPS | | | | | |
| 36 | NESTED LOOPS | | 104 | 11336 | 3387 (1)| 00:00:41 |
|* 37 | HASH JOIN | | 788 | 59100 | 1810 (1)| 00:00:22 |
|* 38 | TABLE ACCESS BY INDEX ROWID | TB201309_DEPTCONGOODS | 807 | 27438 | 1328 (1)| 00:00:16 |
|* 39 | INDEX RANGE SCAN | IDX_09$DEPTCODE | 1652 | | 8 (0)| 00:00:01 |
|* 40 | HASH JOIN | | 16956 | 678K| 481 (1)| 00:00:06 |
| 41 | TABLE ACCESS FULL | tmp1060 | 16956 | 198K| 18 (0)| 00:00:01 |
| 42 | TABLE ACCESS BY INDEX ROWID | TB201309_CONGOODSBILL | 17356 | 491K| 462 (1)| 00:00:06 |
|* 43 | INDEX RANGE SCAN | IDX_201309EXECUTEDATE | 17356 | | 71 (0)| 00:00:01 |
|* 44 | INDEX UNIQUE SCAN | PK_TB201309_CONGOODSDETAIL | 1 | | 1 (0)| 00:00:01 |
| 45 | TABLE ACCESS BY INDEX ROWID | TB201309_CONGOODSDETAIL | 1 | 34 | 2 (0)| 00:00:01 |
| 46 | VIEW | | 1252 | 36308 | 51522 (1)| 00:10:19 |
|* 47 | HASH JOIN | | 1252 | 156K| 51522 (1)| 00:10:19 |
| 48 | NESTED LOOPS | | | | | |
| 49 | NESTED LOOPS | | 1252 | 141K| 51503 (1)| 00:10:19 |
|* 50 | HASH JOIN | | 9473 | 758K| 32546 (1)| 00:06:31 |
| 51 | NESTED LOOPS | | | | | |
| 52 | NESTED LOOPS | | 9473 | 490K| 32083 (1)| 00:06:25 |
| 53 | TABLE ACCESS BY INDEX ROWID| TBCATTODEPARTMENT | 16 | 240 | 16 (0)| 00:00:01 |
|* 54 | INDEX RANGE SCAN | IDX$$_3F470002 | 16 | | 1 (0)| 00:00:01 |
|* 55 | INDEX RANGE SCAN | IDX_09$DEPTCODE | 2496 | | 10 (0)| 00:00:01 |
|* 56 | TABLE ACCESS BY INDEX ROWID | TB201309_DEPTCONGOODS | 593 | 22534 | 2004 (1)| 00:00:25 |
| 57 | TABLE ACCESS BY INDEX ROWID | TB201309_CONGOODSBILL | 17356 | 491K| 462 (1)| 00:00:06 |
|* 58 | INDEX RANGE SCAN | IDX_201309EXECUTEDATE | 17356 | | 71 (0)| 00:00:01 |
|* 59 | INDEX UNIQUE SCAN | PK_TB201309_CONGOODSDETAIL | 1 | | 1 (0)| 00:00:01 |
| 60 | TABLE ACCESS BY INDEX ROWID | TB201309_CONGOODSDETAIL | 1 | 34 | 2 (0)| 00:00:01 |
| 61 | TABLE ACCESS FULL | tmp1060 | 16956 | 198K| 18 (0)| 00:00:01 |
| 62 | NESTED LOOPS | | | | | |
| 63 | NESTED LOOPS | | 17780 | 1267K| 5253 (1)| 00:01:04 |
| 64 | VIEW | | 2 | 22 | 18 (0)| 00:00:01 |
| 65 | HASH UNIQUE | | 1 | 15 | 18 (12)| 00:00:01 |
| 66 | UNION-ALL | | | | | |
|* 67 | TABLE ACCESS BY INDEX ROWID | TBCATTODEPARTMENT | 1 | 15 | 16 (0)| 00:00:01 |
|* 68 | INDEX RANGE SCAN | IDX$$_3F470002 | 16 | | 1 (0)| 00:00:01 |
| 69 | FAST DUAL | | 1 | | 2 (0)| 00:00:01 |
|* 70 | INDEX RANGE SCAN | INDDEPTTYPECODE | 17780 | | 575 (1)| 00:00:07 |
| 71 | TABLE ACCESS BY INDEX ROWID | tbdgs | 17780 | 1076K| 5234 (1)| 00:01:03 |
----------------------------------------------------------------------------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
1 - access("GS"."GOODSCODE"="GCON"."GOODSCODE")
5 - access("JT"."BILLNUMBER"="FL"."BILLNUMBER" AND "JT"."DEPTCODE"="FL"."DEPTCODE" AND
"JT"."GOODSCODE"="FL"."GOODSCODE")
7 - access("M"."BILLNUMBER"="T"."BILLNUMBER")
13 - access("M"."EXECUTEDATE"='20130924')
14 - filter("G"."DEPTTYPE"=0)
15 - access("M"."BILLNUMBER"="G"."BILLNUMBER")
16 - access("G"."DEPTCODE"="D"."DEPTCATEGORYCODE" AND "G"."CATEGORYITEMCODE"="D"."DEPTCATITEMCODE" AND
"D"."NODECODE"='1329')
17 - access("M"."BILLNUMBER"="E"."BILLNUMBER" AND "G"."MAINGOODSID"="E"."INSIDEID")
21 - access("T"."BILLNUMBER"="M"."BILLNUMBER")
26 - access("M"."EXECUTEDATE"='20130924')
27 - filter("G"."DEPTCODE"='1329' AND "G"."DEPTTYPE"=1)
28 - access("M"."BILLNUMBER"="G"."BILLNUMBER")
29 - access("M"."BILLNUMBER"="E"."BILLNUMBER" AND "G"."MAINGOODSID"="E"."INSIDEID")
33 - access("JT"."BILLNUMBER"="FL"."BILLNUMBER" AND "JT"."DEPTCODE"="FL"."DEPTCODE" AND
"JT"."GOODSCODE"="FL"."GOODSCODE")
37 - access("M"."BILLNUMBER"="G"."BILLNUMBER")
38 - filter("G"."DEPTTYPE"=1)
39 - access("G"."DEPTCODE"='1329')
40 - access("T"."BILLNUMBER"="M"."BILLNUMBER")
43 - access("M"."EXECUTEDATE"='20130924')
44 - access("M"."BILLNUMBER"="E"."BILLNUMBER" AND "G"."MAINGOODSID"="E"."INSIDEID")
47 - access("M"."BILLNUMBER"="T"."BILLNUMBER")
50 - access("M"."BILLNUMBER"="G"."BILLNUMBER")
54 - access("D"."NODECODE"='1329')
55 - access("G"."DEPTCODE"="D"."DEPTCATEGORYCODE")
56 - filter("G"."DEPTTYPE"=0 AND "G"."CATEGORYITEMCODE"="D"."DEPTCATITEMCODE")
58 - access("M"."EXECUTEDATE"='20130924')
59 - access("M"."BILLNUMBER"="E"."BILLNUMBER" AND "G"."MAINGOODSID"="E"."INSIDEID")
67 - filter("DEPTCATITEMCODE"='0004')
68 - access("NODECODE"='1329')
70 - access("GS"."DEPTTYPE"="DEPTS"."DEPTTYPE" AND "GS"."DEPTCODE"="DEPTS"."DEPTCODE")
Note
-----
- dynamic sampling used for this statement (level=2)
Statistics
----------------------------------------------------------
14 recursive calls
2 db block gets
102455 consistent gets
39369 physical reads
0 redo size
20040 bytes sent via SQL*Net to client
728 bytes received via SQL*Net from client
21 SQL*Net roundtrips to/from client
0 sorts (memory)
0 sorts (disk)
287 rows processed
SQL>
SQL>
SQL> SELECT /*+ index(G IDX_09$DEPTCODE) index(E PK_TB201309_CONGOODSDETAIL) */
2 E.GoodsCode,
3 G.BILLNUMBER,
4 G.MAINGOODSID,
5 G.INSIDEID,
6 G.DEPTTYPE,
7 G.CATEGORYITEMCODE,
8 G.DEPTCODE,
9 G.PRICEMODE,
10 G.PURCHPRICE,
11 G.WITHHOLDINGRATES,
12 G.MAXPURCHPRICE,
13 G.RATE,
14 G.SUPPLYGOODSTIME,
15 G.COUNTERCODE,
16 G.PRICECOMPENSATYPE,
17 G.YPRICEMODE,
18 G.YPURCHPRICE,
19 G.YWITHHOLDINGRATES,
20 G.YHIGHPURCHPRICE,
21 G.SGSUPPLIERRATE,
22 G.VIPSUPPLIERRATE,
23 G.TEMPBEGINDATE,
24 G.TEMPENDDATE,
25 G.TEMPRATE
26 FROM (SELECT m.BillNumber
27 FROM "xxx".TB201308_ConGoodsBill M, tmp1060 T
28 WHERE m.BillNumber = t.BillNumber
29 AND M.ExecuteDate = '20130924') M,
30 "xxx".TB201308_DeptConGoods G,
31 "xxx".tbCatToDepartment D,
32 "xxx".TB201308_ConGoodsDetail E
33 WHERE M.BillNumber = G.BillNumber
34 AND M.BillNumber = E.BillNumber
35 AND G.DeptType = 0
36 AND D.NodeCode = '1329'
37 AND G.CategoryItemCode = D.DeptCatItemCode
38 AND G.DeptCode = D.DeptCategoryCode
39 AND G.MainGoodsID = E.InsideID;
no rows selected
Elapsed: 00:00:00.10
Execution Plan
----------------------------------------------------------
Plan hash value: 2417502550
---------------------------------------------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
---------------------------------------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 1 | 161 | 82 (2)| 00:00:01 |
|* 1 | HASH JOIN | | 1 | 161 | 82 (2)| 00:00:01 |
| 2 | NESTED LOOPS | | | | | |
| 3 | NESTED LOOPS | | 1 | 149 | 63 (0)| 00:00:01 |
| 4 | NESTED LOOPS | | 3 | 345 | 57 (0)| 00:00:01 |
| 5 | NESTED LOOPS | | 716 | 71600 | 57 (0)| 00:00:01 |
| 6 | TABLE ACCESS BY INDEX ROWID| TB201308_CONGOODSBILL | 23 | 667 | 4 (0)| 00:00:01 |
|* 7 | INDEX RANGE SCAN | IDX_201308EXECUTEDATE | 23 | | 3 (0)| 00:00:01 |
|* 8 | TABLE ACCESS BY INDEX ROWID| TB201308_DEPTCONGOODS | 31 | 2201 | 5 (0)| 00:00:01 |
|* 9 | INDEX RANGE SCAN | IDX201308DEPTCONGOODS | 57 | | 2 (0)| 00:00:01 |
|* 10 | INDEX UNIQUE SCAN | PK_TBCATTODEPARTMENT | 1 | 15 | 0 (0)| 00:00:01 |
|* 11 | INDEX UNIQUE SCAN | PK_TB201308_CONGOODSDETAIL | 1 | | 1 (0)| 00:00:01 |
| 12 | TABLE ACCESS BY INDEX ROWID | TB201308_CONGOODSDETAIL | 1 | 34 | 2 (0)| 00:00:01 |
| 13 | TABLE ACCESS FULL | tmp1060 | 16956 | 198K| 18 (0)| 00:00:01 |
---------------------------------------------------------------------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
1 - access("M"."BILLNUMBER"="T"."BILLNUMBER")
7 - access("M"."EXECUTEDATE"='20130924')
8 - filter("G"."DEPTTYPE"=0)
9 - access("M"."BILLNUMBER"="G"."BILLNUMBER")
10 - access("G"."DEPTCODE"="D"."DEPTCATEGORYCODE" AND "G"."CATEGORYITEMCODE"="D"."DEPTCATITEMCODE"
AND "D"."NODECODE"='1329')
11 - access("M"."BILLNUMBER"="E"."BILLNUMBER" AND "G"."MAINGOODSID"="E"."INSIDEID")
Note
-----
- dynamic sampling used for this statement (level=2)
Statistics
----------------------------------------------------------
5 recursive calls
0 db block gets
66 consistent gets
61 physical reads
0 redo size
2033 bytes sent via SQL*Net to client
508 bytes received via SQL*Net from client
1 SQL*Net roundtrips to/from client
0 sorts (memory)
0 sorts (disk)
0 rows processed
SQL> SELECT COALESCE (JT.GoodsCode, FL.GoodsCode) GoodsCode
2 FROM (SELECT E.GoodsCode,
3 G.BILLNUMBER,
4 G.MAINGOODSID,
5 G.INSIDEID,
6 G.DEPTTYPE,
7 G.CATEGORYITEMCODE,
8 G.DEPTCODE,
9 G.PRICEMODE,
10 G.PURCHPRICE,
11 G.WITHHOLDINGRATES,
12 G.MAXPURCHPRICE,
13 G.RATE,
14 G.SUPPLYGOODSTIME,
15 G.COUNTERCODE,
16 G.PRICECOMPENSATYPE,
17 G.YPRICEMODE,
18 G.YPURCHPRICE,
19 G.YWITHHOLDINGRATES,
20 G.YHIGHPURCHPRICE,
21 G.SGSUPPLIERRATE,
22 G.VIPSUPPLIERRATE,
23 G.TEMPBEGINDATE,
24 G.TEMPENDDATE,
25 G.TEMPRATE
26 FROM (SELECT m.BillNumber
27 FROM "xxx".TB201308_ConGoodsBill M, tmp1060 t
28 WHERE t.BillNumber = m.BillNumber
29 AND M.ExecuteDate = '20130924') M,
30 (SELECT G.BILLNUMBER,
31 G.MAINGOODSID,
32 G.INSIDEID,
33 G.DEPTTYPE,
34 G.CATEGORYITEMCODE,
35 G.DEPTCODE,
36 G.PRICEMODE,
37 G.PURCHPRICE,
38 G.WITHHOLDINGRATES,
39 G.MAXPURCHPRICE,
40 G.RATE,
41 G.SUPPLYGOODSTIME,
42 G.COUNTERCODE,
43 G.PRICECOMPENSATYPE,
44 G.YPRICEMODE,
45 G.YPURCHPRICE,
46 G.YWITHHOLDINGRATES,
47 G.YHIGHPURCHPRICE,
48 G.SGSUPPLIERRATE,
49 G.VIPSUPPLIERRATE,
50 G.TempBeginDate,
51 G.TempEndDate,
52 G.TempRate
53 FROM "xxx".TB201308_DeptConGoods G
54 WHERE G.DeptType = 1 AND G.DeptCode = '1329') G,
55 "xxx".TB201308_ConGoodsDetail E
56 WHERE M.BillNumber = G.BillNumber
57 AND M.BillNumber = E.BillNumber
58 AND G.MainGoodsID = E.InsideID) JT
59 FULL JOIN
60 (SELECT /*+ index(G IDX_09$DEPTCODE) index(E PK_TB201309_CONGOODSDETAIL) */
61 E.GoodsCode,
62 G.BILLNUMBER,
63 G.MAINGOODSID,
64 G.INSIDEID,
65 G.DEPTTYPE,
66 G.CATEGORYITEMCODE,
67 G.DEPTCODE,
68 G.PRICEMODE,
69 G.PURCHPRICE,
70 G.WITHHOLDINGRATES,
71 G.MAXPURCHPRICE,
72 G.RATE,
73 G.SUPPLYGOODSTIME,
74 G.COUNTERCODE,
75 G.PRICECOMPENSATYPE,
76 G.YPRICEMODE,
77 G.YPURCHPRICE,
78 G.YWITHHOLDINGRATES,
79 G.YHIGHPURCHPRICE,
80 G.SGSUPPLIERRATE,
81 G.VIPSUPPLIERRATE,
82 G.TEMPBEGINDATE,
83 G.TEMPENDDATE,
84 G.TEMPRATE
85 FROM (SELECT m.BillNumber
86 FROM "xxx".TB201308_ConGoodsBill M, tmp1060 T
87 WHERE m.BillNumber = t.BillNumber
88 AND M.ExecuteDate = '20130924') M,
89 "xxx".TB201308_DeptConGoods G,
90 "xxx".tbCatToDepartment D,
91 "xxx".TB201308_ConGoodsDetail E
92 WHERE M.BillNumber = G.BillNumber
93 AND M.BillNumber = E.BillNumber
94 AND G.DeptType = 0
95 AND D.NodeCode = '1329'
96 AND G.CategoryItemCode = D.DeptCatItemCode
97 AND G.DeptCode = D.DeptCategoryCode
98 AND G.MainGoodsID = E.InsideID) FL
99 ON JT.BillNumber = FL.BillNumber
100 AND JT.DeptCode = FL.DeptCode
101 AND JT.GoodsCode = FL.GoodsCode;
no rows selected
Elapsed: 00:00:00.10
Execution Plan
----------------------------------------------------------
Plan hash value: 1825425437
------------------------------------------------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
------------------------------------------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 4 | 72 | 204 (1)| 00:00:03 |
| 1 | VIEW | VW_FOJ_0 | 4 | 72 | 204 (1)| 00:00:03 |
|* 2 | HASH JOIN FULL OUTER | | 4 | 232 | 204 (1)| 00:00:03 |
| 3 | VIEW | | 1 | 29 | 82 (2)| 00:00:01 |
|* 4 | HASH JOIN | | 1 | 128 | 82 (2)| 00:00:01 |
| 5 | NESTED LOOPS | | | | | |
| 6 | NESTED LOOPS | | 1 | 116 | 63 (0)| 00:00:01 |
| 7 | NESTED LOOPS | | 3 | 246 | 57 (0)| 00:00:01 |
| 8 | NESTED LOOPS | | 716 | 47972 | 57 (0)| 00:00:01 |
| 9 | TABLE ACCESS BY INDEX ROWID| TB201308_CONGOODSBILL | 23 | 667 | 4 (0)| 00:00:01 |
|* 10 | INDEX RANGE SCAN | IDX_201308EXECUTEDATE | 23 | | 3 (0)| 00:00:01 |
|* 11 | TABLE ACCESS BY INDEX ROWID| TB201308_DEPTCONGOODS | 31 | 1178 | 5 (0)| 00:00:01 |
|* 12 | INDEX RANGE SCAN | IDX201308DEPTCONGOODS | 57 | | 2 (0)| 00:00:01 |
|* 13 | INDEX UNIQUE SCAN | PK_TBCATTODEPARTMENT | 1 | 15 | 0 (0)| 00:00:01 |
|* 14 | INDEX UNIQUE SCAN | PK_TB201308_CONGOODSDETAIL | 1 | | 1 (0)| 00:00:01 |
| 15 | TABLE ACCESS BY INDEX ROWID | TB201308_CONGOODSDETAIL | 1 | 34 | 2 (0)| 00:00:01 |
| 16 | TABLE ACCESS FULL | tmp1060 | 16956 | 198K| 18 (0)| 00:00:01 |
| 17 | VIEW | | 4 | 116 | 122 (1)| 00:00:02 |
|* 18 | HASH JOIN | | 4 | 436 | 122 (1)| 00:00:02 |
| 19 | NESTED LOOPS | | | | | |
| 20 | NESTED LOOPS | | 4 | 388 | 103 (0)| 00:00:02 |
| 21 | NESTED LOOPS | | 23 | 1449 | 57 (0)| 00:00:01 |
| 22 | TABLE ACCESS BY INDEX ROWID | TB201308_CONGOODSBILL | 23 | 667 | 4 (0)| 00:00:01 |
|* 23 | INDEX RANGE SCAN | IDX_201308EXECUTEDATE | 23 | | 3 (0)| 00:00:01 |
|* 24 | TABLE ACCESS BY INDEX ROWID | TB201308_DEPTCONGOODS | 1 | 34 | 5 (0)| 00:00:01 |
|* 25 | INDEX RANGE SCAN | IDX201308DEPTCONGOODS | 57 | | 2 (0)| 00:00:01 |
|* 26 | INDEX UNIQUE SCAN | PK_TB201308_CONGOODSDETAIL | 1 | | 1 (0)| 00:00:01 |
| 27 | TABLE ACCESS BY INDEX ROWID | TB201308_CONGOODSDETAIL | 1 | 34 | 2 (0)| 00:00:01 |
| 28 | TABLE ACCESS FULL | tmp1060 | 16956 | 198K| 18 (0)| 00:00:01 |
------------------------------------------------------------------------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
2 - access("JT"."BILLNUMBER"="FL"."BILLNUMBER" AND "JT"."DEPTCODE"="FL"."DEPTCODE" AND
"JT"."GOODSCODE"="FL"."GOODSCODE")
4 - access("M"."BILLNUMBER"="T"."BILLNUMBER")
10 - access("M"."EXECUTEDATE"='20130924')
11 - filter("G"."DEPTTYPE"=0)
12 - access("M"."BILLNUMBER"="G"."BILLNUMBER")
13 - access("G"."DEPTCODE"="D"."DEPTCATEGORYCODE" AND "G"."CATEGORYITEMCODE"="D"."DEPTCATITEMCODE" AND
"D"."NODECODE"='1329')
14 - access("M"."BILLNUMBER"="E"."BILLNUMBER" AND "G"."MAINGOODSID"="E"."INSIDEID")
18 - access("T"."BILLNUMBER"="M"."BILLNUMBER")
23 - access("M"."EXECUTEDATE"='20130924')
24 - filter("G"."DEPTCODE"='1329' AND "G"."DEPTTYPE"=1)
25 - access("M"."BILLNUMBER"="G"."BILLNUMBER")
26 - access("M"."BILLNUMBER"="E"."BILLNUMBER" AND "G"."MAINGOODSID"="E"."INSIDEID")
Note
-----
- dynamic sampling used for this statement (level=2)
Statistics
----------------------------------------------------------
8 recursive calls
0 db block gets
132 consistent gets
61 physical reads
0 redo size
337 bytes sent via SQL*Net to client
508 bytes received via SQL*Net from client
1 SQL*Net roundtrips to/from client
0 sorts (memory)
0 sorts (disk)
0 rows processed
SQL>
SQL> SELECT COALESCE (JT.GoodsCode, FL.GoodsCode) GoodsCode
2 FROM (SELECT E.GoodsCode,
3 G.BILLNUMBER,
4 G.MAINGOODSID,
5 G.INSIDEID,
6 G.DEPTTYPE,
7 G.CATEGORYITEMCODE,
8 G.DEPTCODE,
9 G.PRICEMODE,
10 G.PURCHPRICE,
11 G.WITHHOLDINGRATES,
12 G.MAXPURCHPRICE,
13 G.RATE,
14 G.SUPPLYGOODSTIME,
15 G.COUNTERCODE,
16 G.PRICECOMPENSATYPE,
17 G.YPRICEMODE,
18 G.YPURCHPRICE,
19 G.YWITHHOLDINGRATES,
20 G.YHIGHPURCHPRICE,
21 G.SGSUPPLIERRATE,
22 G.VIPSUPPLIERRATE,
23 G.TEMPBEGINDATE,
24 G.TEMPENDDATE,
25 G.TEMPRATE
26 FROM (SELECT m.BillNumber
27 FROM "xxx".TB201309_ConGoodsBill M, tmp1060 t
28 WHERE t.BillNumber = m.BillNumber
29 AND M.ExecuteDate = '20130924') M,
30 (SELECT G.BILLNUMBER,
31 G.MAINGOODSID,
32 G.INSIDEID,
33 G.DEPTTYPE,
34 G.CATEGORYITEMCODE,
35 G.DEPTCODE,
36 G.PRICEMODE,
37 G.PURCHPRICE,
38 G.WITHHOLDINGRATES,
39 G.MAXPURCHPRICE,
40 G.RATE,
41 G.SUPPLYGOODSTIME,
42 G.COUNTERCODE,
43 G.PRICECOMPENSATYPE,
44 G.YPRICEMODE,
45 G.YPURCHPRICE,
46 G.YWITHHOLDINGRATES,
47 G.YHIGHPURCHPRICE,
48 G.SGSUPPLIERRATE,
49 G.VIPSUPPLIERRATE,
50 G.TempBeginDate,
51 G.TempEndDate,
52 G.TempRate
53 FROM "xxx".TB201309_DeptConGoods G
54 WHERE G.DeptType = 1 AND G.DeptCode = '1329') G,
55 "xxx".TB201309_ConGoodsDetail E
56 WHERE M.BillNumber = G.BillNumber
57 AND M.BillNumber = E.BillNumber
58 AND G.MainGoodsID = E.InsideID) JT
59 FULL JOIN
60 (SELECT /*+ index(G IDX_09$DEPTCODE) index(E PK_TB201309_CONGOODSDETAIL) */
61 E.GoodsCode,
62 G.BILLNUMBER,
G.MAINGOODSID,
63 64 G.INSIDEID,
65 G.DEPTTYPE,
66 G.CATEGORYITEMCODE,
67 G.DEPTCODE,
68 G.PRICEMODE,
69 G.PURCHPRICE,
70 G.WITHHOLDINGRATES,
71 G.MAXPURCHPRICE,
72 G.RATE,
73 G.SUPPLYGOODSTIME,
74 G.COUNTERCODE,
75 G.PRICECOMPENSATYPE,
76 G.YPRICEMODE,
77 G.YPURCHPRICE,
78 G.YWITHHOLDINGRATES,
79 G.YHIGHPURCHPRICE,
80 G.SGSUPPLIERRATE,
81 G.VIPSUPPLIERRATE,
82 G.TEMPBEGINDATE,
83 G.TEMPENDDATE,
84 G.TEMPRATE
85 FROM (SELECT m.BillNumber
86 FROM "xxx".TB201309_ConGoodsBill M, tmp1060 T
87 WHERE m.BillNumber = t.BillNumber
88 AND M.ExecuteDate = '20130924') M,
89 "xxx".TB201309_DeptConGoods G,
90 "xxx".tbCatToDepartment D,
91 "xxx".TB201309_ConGoodsDetail E
92 WHERE M.BillNumber = G.BillNumber
93 AND M.BillNumber = E.BillNumber
94 AND G.DeptType = 0
95 AND D.NodeCode = '1329'
96 AND G.CategoryItemCode = D.DeptCatItemCode
97 AND G.DeptCode = D.DeptCategoryCode
98 AND G.MainGoodsID = E.InsideID) FL
99 ON JT.BillNumber = FL.BillNumber
100 AND JT.DeptCode = FL.DeptCode
101 AND JT.GoodsCode = FL.GoodsCode;
285 rows selected.
Elapsed: 00:00:01.32
Execution Plan
----------------------------------------------------------
Plan hash value: 449683333
-------------------------------------------------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
-------------------------------------------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 1252 | 22536 | 54909 (1)| 00:10:59 |
| 1 | VIEW | VW_FOJ_0 | 1252 | 22536 | 54909 (1)| 00:10:59 |
|* 2 | HASH JOIN FULL OUTER | | 1252 | 72616 | 54909 (1)| 00:10:59 |
| 3 | VIEW | | 104 | 3016 | 3387 (1)| 00:00:41 |
| 4 | NESTED LOOPS | | | | | |
| 5 | NESTED LOOPS | | 104 | 11336 | 3387 (1)| 00:00:41 |
|* 6 | HASH JOIN | | 788 | 59100 | 1810 (1)| 00:00:22 |
|* 7 | TABLE ACCESS BY INDEX ROWID | TB201309_DEPTCONGOODS | 807 | 27438 | 1328 (1)| 00:00:16 |
|* 8 | INDEX RANGE SCAN | IDX_09$DEPTCODE | 1652 | | 8 (0)| 00:00:01 |
|* 9 | HASH JOIN | | 16956 | 678K| 481 (1)| 00:00:06 |
| 10 | TABLE ACCESS FULL | tmp1060 | 16956 | 198K| 18 (0)| 00:00:01 |
| 11 | TABLE ACCESS BY INDEX ROWID | TB201309_CONGOODSBILL | 17356 | 491K| 462 (1)| 00:00:06 |
|* 12 | INDEX RANGE SCAN | IDX_201309EXECUTEDATE | 17356 | | 71 (0)| 00:00:01 |
|* 13 | INDEX UNIQUE SCAN | PK_TB201309_CONGOODSDETAIL | 1 | | 1 (0)| 00:00:01 |
| 14 | TABLE ACCESS BY INDEX ROWID | TB201309_CONGOODSDETAIL | 1 | 34 | 2 (0)| 00:00:01 |
| 15 | VIEW | | 1252 | 36308 | 51522 (1)| 00:10:19 |
|* 16 | HASH JOIN | | 1252 | 156K| 51522 (1)| 00:10:19 |
| 17 | NESTED LOOPS | | | | | |
| 18 | NESTED LOOPS | | 1252 | 141K| 51503 (1)| 00:10:19 |
|* 19 | HASH JOIN | | 9473 | 758K| 32546 (1)| 00:06:31 |
| 20 | NESTED LOOPS | | | | | |
| 21 | NESTED LOOPS | | 9473 | 490K| 32083 (1)| 00:06:25 |
| 22 | TABLE ACCESS BY INDEX ROWID| TBCATTODEPARTMENT | 16 | 240 | 16 (0)| 00:00:01 |
|* 23 | INDEX RANGE SCAN | IDX$$_3F470002 | 16 | | 1 (0)| 00:00:01 |
|* 24 | INDEX RANGE SCAN | IDX_09$DEPTCODE | 2496 | | 10 (0)| 00:00:01 |
|* 25 | TABLE ACCESS BY INDEX ROWID | TB201309_DEPTCONGOODS | 593 | 22534 | 2004 (1)| 00:00:25 |
| 26 | TABLE ACCESS BY INDEX ROWID | TB201309_CONGOODSBILL | 17356 | 491K| 462 (1)| 00:00:06 |
|* 27 | INDEX RANGE SCAN | IDX_201309EXECUTEDATE | 17356 | | 71 (0)| 00:00:01 |
|* 28 | INDEX UNIQUE SCAN | PK_TB201309_CONGOODSDETAIL | 1 | | 1 (0)| 00:00:01 |
| 29 | TABLE ACCESS BY INDEX ROWID | TB201309_CONGOODSDETAIL | 1 | 34 | 2 (0)| 00:00:01 |
| 30 | TABLE ACCESS FULL | tmp1060 | 16956 | 198K| 18 (0)| 00:00:01 |
-------------------------------------------------------------------------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
2 - access("JT"."BILLNUMBER"="FL"."BILLNUMBER" AND "JT"."DEPTCODE"="FL"."DEPTCODE" AND
"JT"."GOODSCODE"="FL"."GOODSCODE")
6 - access("M"."BILLNUMBER"="G"."BILLNUMBER")
7 - filter("G"."DEPTTYPE"=1)
8 - access("G"."DEPTCODE"='1329')
9 - access("T"."BILLNUMBER"="M"."BILLNUMBER")
12 - access("M"."EXECUTEDATE"='20130924')
13 - access("M"."BILLNUMBER"="E"."BILLNUMBER" AND "G"."MAINGOODSID"="E"."INSIDEID")
16 - access("M"."BILLNUMBER"="T"."BILLNUMBER")
19 - access("M"."BILLNUMBER"="G"."BILLNUMBER")
23 - access("D"."NODECODE"='1329')
24 - access("G"."DEPTCODE"="D"."DEPTCATEGORYCODE")
25 - filter("G"."DEPTTYPE"=0 AND "G"."CATEGORYITEMCODE"="D"."DEPTCATITEMCODE")
27 - access("M"."EXECUTEDATE"='20130924')
28 - access("M"."BILLNUMBER"="E"."BILLNUMBER" AND "G"."MAINGOODSID"="E"."INSIDEID")
Note
-----
- dynamic sampling used for this statement (level=2)
Statistics
----------------------------------------------------------
8 recursive calls
0 db block gets
25974 consistent gets
47 physical reads
0 redo size
6797 bytes sent via SQL*Net to client
717 bytes received via SQL*Net from client
20 SQL*Net roundtrips to/from client
0 sorts (memory)
0 sorts (disk)
285 rows processed
SQL>
SQL>
SQL> SELECT COALESCE (JT.GoodsCode, FL.GoodsCode) GoodsCode
2 FROM (SELECT E.GoodsCode,
3 G.BILLNUMBER,
4 G.MAINGOODSID,
5 G.INSIDEID,
6 G.DEPTTYPE,
7 G.CATEGORYITEMCODE,
8 G.DEPTCODE,
9 G.PRICEMODE,
10 G.PURCHPRICE,
11 G.WITHHOLDINGRATES,
12 G.MAXPURCHPRICE,
13 G.RATE,
14 G.SUPPLYGOODSTIME,
15 G.COUNTERCODE,
16 G.PRICECOMPENSATYPE,
17 G.YPRICEMODE,
18 G.YPURCHPRICE,
19 G.YWITHHOLDINGRATES,
20 G.YHIGHPURCHPRICE,
21 G.SGSUPPLIERRATE,
22 G.VIPSUPPLIERRATE,
23 G.TEMPBEGINDATE,
24 G.TEMPENDDATE,
25 G.TEMPRATE
26 FROM (SELECT m.BillNumber
27 FROM "xxx".TB201308_ConGoodsBill M, tmp1060 t
28 WHERE t.BillNumber = m.BillNumber
29 AND M.ExecuteDate = '20130924') M,
30 (SELECT G.BILLNUMBER,
31 G.MAINGOODSID,
32 G.INSIDEID,
33 G.DEPTTYPE,
34 G.CATEGORYITEMCODE,
35 G.DEPTCODE,
36 G.PRICEMODE,
37 G.PURCHPRICE,
38 G.WITHHOLDINGRATES,
39 G.MAXPURCHPRICE,
40 G.RATE,
41 G.SUPPLYGOODSTIME,
42 G.COUNTERCODE,
43 G.PRICECOMPENSATYPE,
44 G.YPRICEMODE,
45 G.YPURCHPRICE,
46 G.YWITHHOLDINGRATES,
47 G.YHIGHPURCHPRICE,
48 G.SGSUPPLIERRATE,
49 G.VIPSUPPLIERRATE,
50 G.TempBeginDate,
51 G.TempEndDate,
52 G.TempRate
53 FROM "xxx".TB201308_DeptConGoods G
54 WHERE G.DeptType = 1 AND G.DeptCode = '1329') G,
55 "xxx".TB201308_ConGoodsDetail E
56 WHERE M.BillNumber = G.BillNumber
57 AND M.BillNumber = E.BillNumber
58 AND G.MainGoodsID = E.InsideID) JT
59 FULL JOIN
60 (SELECT /*+ index(G IDX_09$DEPTCODE) index(E PK_TB201309_CONGOODSDETAIL) */
61 E.GoodsCode,
62 G.BILLNUMBER,
63 G.MAINGOODSID,
64 G.INSIDEID,
65 G.DEPTTYPE,
66 G.CATEGORYITEMCODE,
67 G.DEPTCODE,
68 G.PRICEMODE,
69 G.PURCHPRICE,
70 G.WITHHOLDINGRATES,
71 G.MAXPURCHPRICE,
72 G.RATE,
73 G.SUPPLYGOODSTIME,
74 G.COUNTERCODE,
75 G.PRICECOMPENSATYPE,
76 G.YPRICEMODE,
77 G.YPURCHPRICE,
78 G.YWITHHOLDINGRATES,
79 G.YHIGHPURCHPRICE,
80 G.SGSUPPLIERRATE,
81 G.VIPSUPPLIERRATE,
82 G.TEMPBEGINDATE,
83 G.TEMPENDDATE,
84 G.TEMPRATE
85 FROM (SELECT m.BillNumber
86 FROM "xxx".TB201308_ConGoodsBill M, tmp1060 T
87 WHERE m.BillNumber = t.BillNumber
88 AND M.ExecuteDate = '20130924') M,
89 "xxx".TB201308_DeptConGoods G,
90 "xxx".tbCatToDepartment D,
91 "xxx".TB201308_ConGoodsDetail E
92 WHERE M.BillNumber = G.BillNumber
93 AND M.BillNumber = E.BillNumber
94 AND G.DeptType = 0
95 AND D.NodeCode = '1329'
96 AND G.CategoryItemCode = D.DeptCatItemCode
97 AND G.DeptCode = D.DeptCategoryCode
98 AND G.MainGoodsID = E.InsideID) FL
99 ON JT.BillNumber = FL.BillNumber
100 AND JT.DeptCode = FL.DeptCode
101 AND JT.GoodsCode = FL.GoodsCode
102
SQL>
SQL>
SQL> UNION ALL
SP2-0042: unknown command "UNION ALL" - rest of line ignored.
SQL> SELECT COALESCE (JT.GoodsCode, FL.GoodsCode) GoodsCode
2 FROM (SELECT E.GoodsCode,
3 G.BILLNUMBER,
4 G.MAINGOODSID,
5 G.INSIDEID,
6 G.DEPTTYPE,
7 G.CATEGORYITEMCODE,
8 G.DEPTCODE,
9 G.PRICEMODE,
10 G.PURCHPRICE,
11 G.WITHHOLDINGRATES,
12 G.MAXPURCHPRICE,
13 G.RATE,
14 G.SUPPLYGOODSTIME,
15 G.COUNTERCODE,
16 G.PRICECOMPENSATYPE,
17 G.YPRICEMODE,
18 G.YPURCHPRICE,
19 G.YWITHHOLDINGRATES,
20 G.YHIGHPURCHPRICE,
21 G.SGSUPPLIERRATE,
22 G.VIPSUPPLIERRATE,
23 G.TEMPBEGINDATE,
24 G.TEMPENDDATE,
25 G.TEMPRATE
26 FROM (SELECT m.BillNumber
27 FROM "xxx".TB201309_ConGoodsBill M, tmp1060 t
28 WHERE t.BillNumber = m.BillNumber
29 AND M.ExecuteDate = '20130924') M,
30 (SELECT G.BILLNUMBER,
31 G.MAINGOODSID,
32 G.INSIDEID,
33 G.DEPTTYPE,
34 G.CATEGORYITEMCODE,
35 G.DEPTCODE,
36 G.PRICEMODE,
37 G.PURCHPRICE,
38 G.WITHHOLDINGRATES,
39 G.MAXPURCHPRICE,
40 G.RATE,
41 G.SUPPLYGOODSTIME,
42 G.COUNTERCODE,
43 G.PRICECOMPENSATYPE,
44 G.YPRICEMODE,
45 G.YPURCHPRICE,
46 G.YWITHHOLDINGRATES,
47 G.YHIGHPURCHPRICE,
48 G.SGSUPPLIERRATE,
49 G.VIPSUPPLIERRATE,
50 G.TempBeginDate,
51 G.TempEndDate,
52 G.TempRate
53 FROM "xxx".TB201309_DeptConGoods G
54 WHERE G.DeptType = 1 AND G.DeptCode = '1329') G,
55 "xxx".TB201309_ConGoodsDetail E
56 WHERE M.BillNumber = G.BillNumber
57 AND M.BillNumber = E.BillNumber
58 AND G.MainGoodsID = E.InsideID) JT
59 FULL JOIN
60 (SELECT /*+ index(G IDX_09$DEPTCODE) index(E PK_TB201309_CONGOODSDETAIL) */
61 E.GoodsCode,
62 G.BILLNUMBER,
63 G.MAINGOODSID,
64 G.INSIDEID,
65 G.DEPTTYPE,
66 G.CATEGORYITEMCODE,
67 G.DEPTCODE,
68 G.PRICEMODE,
69 G.PURCHPRICE,
70 G.WITHHOLDINGRATES,
71 G.MAXPURCHPRICE,
72 G.RATE,
73 G.SUPPLYGOODSTIME,
74 G.COUNTERCODE,
75 G.PRICECOMPENSATYPE,
76 G.YPRICEMODE,
77 G.YPURCHPRICE,
78 G.YWITHHOLDINGRATES,
79 G.YHIGHPURCHPRICE,
80 G.SGSUPPLIERRATE,
81 G.VIPSUPPLIERRATE,
82 G.TEMPBEGINDATE,
83 G.TEMPENDDATE,
84 G.TEMPRATE
85 FROM (SELECT m.BillNumber
86 FROM "xxx".TB201309_ConGoodsBill M, tmp1060 T
87 WHERE m.BillNumber = t.BillNumber
88 AND M.ExecuteDate = '20130924') M,
89 "xxx".TB201309_DeptConGoods G,
90 "xxx".tbCatToDepartment D,
91 "xxx".TB201309_ConGoodsDetail E
92 WHERE M.BillNumber = G.BillNumber
93 AND M.BillNumber = E.BillNumber
94 AND G.DeptType = 0
95 AND D.NodeCode = '1329'
96 AND G.CategoryItemCode = D.DeptCatItemCode
97 AND G.DeptCode = D.DeptCategoryCode
98 AND G.MainGoodsID = E.InsideID) FL
99 ON JT.BillNumber = FL.BillNumber
100 AND JT.DeptCode = FL.DeptCode
101 AND JT.GoodsCode = FL.GoodsCode;
285 rows selected.
Elapsed: 00:00:05.01
Execution Plan
----------------------------------------------------------
Plan hash value: 449683333
-------------------------------------------------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
-------------------------------------------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 1252 | 22536 | 54909 (1)| 00:10:59 |
| 1 | VIEW | VW_FOJ_0 | 1252 | 22536 | 54909 (1)| 00:10:59 |
|* 2 | HASH JOIN FULL OUTER | | 1252 | 72616 | 54909 (1)| 00:10:59 |
| 3 | VIEW | | 104 | 3016 | 3387 (1)| 00:00:41 |
| 4 | NESTED LOOPS | | | | | |
| 5 | NESTED LOOPS | | 104 | 11336 | 3387 (1)| 00:00:41 |
|* 6 | HASH JOIN | | 788 | 59100 | 1810 (1)| 00:00:22 |
|* 7 | TABLE ACCESS BY INDEX ROWID | TB201309_DEPTCONGOODS | 807 | 27438 | 1328 (1)| 00:00:16 |
|* 8 | INDEX RANGE SCAN | IDX_09$DEPTCODE | 1652 | | 8 (0)| 00:00:01 |
|* 9 | HASH JOIN | | 16956 | 678K| 481 (1)| 00:00:06 |
| 10 | TABLE ACCESS FULL | tmp1060 | 16956 | 198K| 18 (0)| 00:00:01 |
| 11 | TABLE ACCESS BY INDEX ROWID | TB201309_CONGOODSBILL | 17356 | 491K| 462 (1)| 00:00:06 |
|* 12 | INDEX RANGE SCAN | IDX_201309EXECUTEDATE | 17356 | | 71 (0)| 00:00:01 |
|* 13 | INDEX UNIQUE SCAN | PK_TB201309_CONGOODSDETAIL | 1 | | 1 (0)| 00:00:01 |
| 14 | TABLE ACCESS BY INDEX ROWID | TB201309_CONGOODSDETAIL | 1 | 34 | 2 (0)| 00:00:01 |
| 15 | VIEW | | 1252 | 36308 | 51522 (1)| 00:10:19 |
|* 16 | HASH JOIN | | 1252 | 156K| 51522 (1)| 00:10:19 |
| 17 | NESTED LOOPS | | | | | |
| 18 | NESTED LOOPS | | 1252 | 141K| 51503 (1)| 00:10:19 |
|* 19 | HASH JOIN | | 9473 | 758K| 32546 (1)| 00:06:31 |
| 20 | NESTED LOOPS | | | | | |
| 21 | NESTED LOOPS | | 9473 | 490K| 32083 (1)| 00:06:25 |
| 22 | TABLE ACCESS BY INDEX ROWID| TBCATTODEPARTMENT | 16 | 240 | 16 (0)| 00:00:01 |
|* 23 | INDEX RANGE SCAN | IDX$$_3F470002 | 16 | | 1 (0)| 00:00:01 |
|* 24 | INDEX RANGE SCAN | IDX_09$DEPTCODE | 2496 | | 10 (0)| 00:00:01 |
|* 25 | TABLE ACCESS BY INDEX ROWID | TB201309_DEPTCONGOODS | 593 | 22534 | 2004 (1)| 00:00:25 |
| 26 | TABLE ACCESS BY INDEX ROWID | TB201309_CONGOODSBILL | 17356 | 491K| 462 (1)| 00:00:06 |
|* 27 | INDEX RANGE SCAN | IDX_201309EXECUTEDATE | 17356 | | 71 (0)| 00:00:01 |
|* 28 | INDEX UNIQUE SCAN | PK_TB201309_CONGOODSDETAIL | 1 | | 1 (0)| 00:00:01 |
| 29 | TABLE ACCESS BY INDEX ROWID | TB201309_CONGOODSDETAIL | 1 | 34 | 2 (0)| 00:00:01 |
| 30 | TABLE ACCESS FULL | tmp1060 | 16956 | 198K| 18 (0)| 00:00:01 |
-------------------------------------------------------------------------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
2 - access("JT"."BILLNUMBER"="FL"."BILLNUMBER" AND "JT"."DEPTCODE"="FL"."DEPTCODE" AND
"JT"."GOODSCODE"="FL"."GOODSCODE")
6 - access("M"."BILLNUMBER"="G"."BILLNUMBER")
7 - filter("G"."DEPTTYPE"=1)
8 - access("G"."DEPTCODE"='1329')
9 - access("T"."BILLNUMBER"="M"."BILLNUMBER")
12 - access("M"."EXECUTEDATE"='20130924')
13 - access("M"."BILLNUMBER"="E"."BILLNUMBER" AND "G"."MAINGOODSID"="E"."INSIDEID")
16 - access("M"."BILLNUMBER"="T"."BILLNUMBER")
19 - access("M"."BILLNUMBER"="G"."BILLNUMBER")
23 - access("D"."NODECODE"='1329')
24 - access("G"."DEPTCODE"="D"."DEPTCATEGORYCODE")
25 - filter("G"."DEPTTYPE"=0 AND "G"."CATEGORYITEMCODE"="D"."DEPTCATITEMCODE")
27 - access("M"."EXECUTEDATE"='20130924')
28 - access("M"."BILLNUMBER"="E"."BILLNUMBER" AND "G"."MAINGOODSID"="E"."INSIDEID")
Note
-----
- dynamic sampling used for this statement (level=2)
Statistics
----------------------------------------------------------
8 recursive calls
0 db block gets
25931 consistent gets
118 physical reads
0 redo size
6797 bytes sent via SQL*Net to client
717 bytes received via SQL*Net from client
20 SQL*Net roundtrips to/from client
0 sorts (memory)
0 sorts (disk)
285 rows processed
SQL>
SQL>
SQL> /* Formatted on 2013/9/25 0:34:29 (QP5 v5.252.13127.32867) */
SQL> SELECT GS.*
2 FROM "xxx".tbdgs GS,
3 (SELECT COALESCE (JT.GoodsCode, FL.GoodsCode) GoodsCode
4 FROM (SELECT E.GoodsCode,
5 G.BILLNUMBER,
6 G.MAINGOODSID,
7 G.INSIDEID,
8 G.DEPTTYPE,
9 G.CATEGORYITEMCODE,
10 G.DEPTCODE,
11 G.PRICEMODE,
12 G.PURCHPRICE,
13 G.WITHHOLDINGRATES,
14 G.MAXPURCHPRICE,
15 G.RATE,
16 G.SUPPLYGOODSTIME,
17 G.COUNTERCODE,
18 G.PRICECOMPENSATYPE,
19 G.YPRICEMODE,
20 G.YPURCHPRICE,
21 G.YWITHHOLDINGRATES,
22 G.YHIGHPURCHPRICE,
23 G.SGSUPPLIERRATE,
24 G.VIPSUPPLIERRATE,
25 G.TEMPBEGINDATE,
26 G.TEMPENDDATE,
27 G.TEMPRATE
28 FROM (SELECT m.BillNumber
29 FROM "xxx".TB201308_ConGoodsBill M, tmp1060 t
30 WHERE t.BillNumber = m.BillNumber
31 AND M.ExecuteDate = '20130924') M,
32 (SELECT G.BILLNUMBER,
33 G.MAINGOODSID,
34 G.INSIDEID,
35 G.DEPTTYPE,
36 G.CATEGORYITEMCODE,
37 G.DEPTCODE,
38 G.PRICEMODE,
39 G.PURCHPRICE,
40 G.WITHHOLDINGRATES,
41 G.MAXPURCHPRICE,
42 G.RATE,
43 G.SUPPLYGOODSTIME,
44 G.COUNTERCODE,
45 G.PRICECOMPENSATYPE,
46 G.YPRICEMODE,
47 G.YPURCHPRICE,
48 G.YWITHHOLDINGRATES,
49 G.YHIGHPURCHPRICE,
50 G.SGSUPPLIERRATE,
51 G.VIPSUPPLIERRATE,
52 G.TempBeginDate,
53 G.TempEndDate,
54 G.TempRate
55 FROM "xxx".TB201308_DeptConGoods G
56 WHERE G.DeptType = 1 AND G.DeptCode = '1329') G,
57 "xxx".TB201308_ConGoodsDetail E
58 WHERE M.BillNumber = G.BillNumber
59 AND M.BillNumber = E.BillNumber
60 AND G.MainGoodsID = E.InsideID) JT
61 FULL JOIN
62 (SELECT /*+ index(G IDX_09$DEPTCODE) index(E PK_TB201309_CONGOODSDETAIL) */
63 E.GoodsCode,
64 G.BILLNUMBER,
65 G.MAINGOODSID,
66 G.INSIDEID,
67 G.DEPTTYPE,
68 G.CATEGORYITEMCODE,
69 G.DEPTCODE,
70 G.PRICEMODE,
71 G.PURCHPRICE,
72 G.WITHHOLDINGRATES,
73 G.MAXPURCHPRICE,
74 G.RATE,
75 G.SUPPLYGOODSTIME,
76 G.COUNTERCODE,
77 G.PRICECOMPENSATYPE,
78 G.YPRICEMODE,
79 G.YPURCHPRICE,
80 G.YWITHHOLDINGRATES,
81 G.YHIGHPURCHPRICE,
82 G.SGSUPPLIERRATE,
83 G.VIPSUPPLIERRATE,
84 G.TEMPBEGINDATE,
85 G.TEMPENDDATE,
86 G.TEMPRATE
87 FROM (SELECT m.BillNumber
88 FROM "xxx".TB201308_ConGoodsBill M, tmp1060 T
89 WHERE m.BillNumber = t.BillNumber
90 AND M.ExecuteDate = '20130924') M,
91 "xxx".TB201308_DeptConGoods G,
92 "xxx".tbCatToDepartment D,
93 "xxx".TB201308_ConGoodsDetail E
94 WHERE M.BillNumber = G.BillNumber
95 AND M.BillNumber = E.BillNumber
96 AND G.DeptType = 0
97 AND D.NodeCode = '1329'
98 AND G.CategoryItemCode = D.DeptCatItemCode
99 AND G.DeptCode = D.DeptCategoryCode
100 AND G.MainGoodsID = E.InsideID) FL
101 ON JT.BillNumber = FL.BillNumber
102 AND JT.DeptCode = FL.DeptCode
103 AND JT.GoodsCode = FL.GoodsCode
104 UNION ALL
105 SELECT COALESCE (JT.GoodsCode, FL.GoodsCode) GoodsCode
106 FROM (SELECT E.GoodsCode,
107 G.BILLNUMBER,
108 G.MAINGOODSID,
109 G.INSIDEID,
110 G.DEPTTYPE,
111 G.CATEGORYITEMCODE,
112 G.DEPTCODE,
113 G.PRICEMODE,
114 G.PURCHPRICE,
115 G.WITHHOLDINGRATES,
116 G.MAXPURCHPRICE,
117 G.RATE,
118 G.SUPPLYGOODSTIME,
119 G.COUNTERCODE,
120 G.PRICECOMPENSATYPE,
121 G.YPRICEMODE,
122 G.YPURCHPRICE,
123 G.YWITHHOLDINGRATES,
124 G.YHIGHPURCHPRICE,
125 G.SGSUPPLIERRATE,
126 G.VIPSUPPLIERRATE,
127 G.TEMPBEGINDATE,
128 G.TEMPENDDATE,
129 G.TEMPRATE
130 FROM (SELECT m.BillNumber
131 FROM "xxx".TB201309_ConGoodsBill M, tmp1060 t
132 WHERE t.BillNumber = m.BillNumber
133 AND M.ExecuteDate = '20130924') M,
134 (SELECT G.BILLNUMBER,
135 G.MAINGOODSID,
136 G.INSIDEID,
137 G.DEPTTYPE,
138 G.CATEGORYITEMCODE,
139 G.DEPTCODE,
140 G.PRICEMODE,
141 G.PURCHPRICE,
142 G.WITHHOLDINGRATES,
143 G.MAXPURCHPRICE,
144 G.RATE,
145 G.SUPPLYGOODSTIME,
146 G.COUNTERCODE,
147 G.PRICECOMPENSATYPE,
148 G.YPRICEMODE,
149 G.YPURCHPRICE,
150 G.YWITHHOLDINGRATES,
151 G.YHIGHPURCHPRICE,
152 G.SGSUPPLIERRATE,
153 G.VIPSUPPLIERRATE,
154 G.TempBeginDate,
155 G.TempEndDate,
156 G.TempRate
157 FROM "xxx".TB201309_DeptConGoods G
158 WHERE G.DeptType = 1 AND G.DeptCode = '1329') G,
159 "xxx".TB201309_ConGoodsDetail E
160 WHERE M.BillNumber = G.BillNumber
161 AND M.BillNumber = E.BillNumber
162 AND G.MainGoodsID = E.InsideID) JT
163 FULL JOIN
164 (SELECT /*+ index(G IDX_09$DEPTCODE) index(E PK_TB201309_CONGOODSDETAIL) */
165 E.GoodsCode,
166 G.BILLNUMBER,
167 G.MAINGOODSID,
168 G.INSIDEID,
169 G.DEPTTYPE,
170 G.CATEGORYITEMCODE,
171 G.DEPTCODE,
172 G.PRICEMODE,
173 G.PURCHPRICE,
174 G.WITHHOLDINGRATES,
175 G.MAXPURCHPRICE,
176 G.RATE,
177 G.SUPPLYGOODSTIME,
178 G.COUNTERCODE,
179 G.PRICECOMPENSATYPE,
180 G.YPRICEMODE,
181 G.YPURCHPRICE,
182 G.YWITHHOLDINGRATES,
183 G.YHIGHPURCHPRICE,
184 G.SGSUPPLIERRATE,
185 G.VIPSUPPLIERRATE,
186 G.TEMPBEGINDATE,
187 G.TEMPENDDATE,
188 G.TEMPRATE
189 FROM (SELECT m.BillNumber
190 FROM "xxx".TB201309_ConGoodsBill M, tmp1060 T
191 WHERE m.BillNumber = t.BillNumber
192 AND M.ExecuteDate = '20130924') M,
193 "xxx".TB201309_DeptConGoods G,
194 "xxx".tbCatToDepartment D,
195 "xxx".TB201309_ConGoodsDetail E
196 WHERE M.BillNumber = G.BillNumber
197 AND M.BillNumber = E.BillNumber
198 AND G.DeptType = 0
199 AND D.NodeCode = '1329'
200 AND G.CategoryItemCode = D.DeptCatItemCode
201 AND G.DeptCode = D.DeptCategoryCode
202 AND G.MainGoodsID = E.InsideID) FL
203 ON JT.BillNumber = FL.BillNumber
204 AND JT.DeptCode = FL.DeptCode
205 AND JT.GoodsCode = FL.GoodsCode) GCON
206 WHERE GS.GoodsCode = GCON.GoodsCode;
58325 rows selected.
Elapsed: 00:00:51.65
Execution Plan
----------------------------------------------------------
Plan hash value: 1153630427
-----------------------------------------------------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
-----------------------------------------------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 210K| 14M| 208K (1)| 00:41:42 |
| 1 | NESTED LOOPS | | | | | |
| 2 | NESTED LOOPS | | 210K| 14M| 208K (1)| 00:41:42 |
| 3 | VIEW | | 1256 | 11304 | 55113 (1)| 00:11:02 |
| 4 | UNION-ALL | | | | | |
| 5 | VIEW | VW_FOJ_0 | 4 | 72 | 204 (1)| 00:00:03 |
|* 6 | HASH JOIN FULL OUTER | | 4 | 232 | 204 (1)| 00:00:03 |
| 7 | VIEW | | 1 | 29 | 82 (2)| 00:00:01 |
|* 8 | HASH JOIN | | 1 | 128 | 82 (2)| 00:00:01 |
| 9 | NESTED LOOPS | | | | | |
| 10 | NESTED LOOPS | | 1 | 116 | 63 (0)| 00:00:01 |
| 11 | NESTED LOOPS | | 3 | 246 | 57 (0)| 00:00:01 |
| 12 | NESTED LOOPS | | 716 | 47972 | 57 (0)| 00:00:01 |
| 13 | TABLE ACCESS BY INDEX ROWID | TB201308_CONGOODSBILL | 23 | 667 | 4 (0)| 00:00:01 |
|* 14 | INDEX RANGE SCAN | IDX_201308EXECUTEDATE | 23 | | 3 (0)| 00:00:01 |
|* 15 | TABLE ACCESS BY INDEX ROWID | TB201308_DEPTCONGOODS | 31 | 1178 | 5 (0)| 00:00:01 |
|* 16 | INDEX RANGE SCAN | IDX201308DEPTCONGOODS | 57 | | 2 (0)| 00:00:01 |
|* 17 | INDEX UNIQUE SCAN | PK_TBCATTODEPARTMENT | 1 | 15 | 0 (0)| 00:00:01 |
|* 18 | INDEX UNIQUE SCAN | PK_TB201308_CONGOODSDETAIL | 1 | | 1 (0)| 00:00:01 |
| 19 | TABLE ACCESS BY INDEX ROWID | TB201308_CONGOODSDETAIL | 1 | 34 | 2 (0)| 00:00:01 |
| 20 | TABLE ACCESS FULL | tmp1060 | 16956 | 198K| 18 (0)| 00:00:01 |
| 21 | VIEW | | 4 | 116 | 122 (1)| 00:00:02 |
|* 22 | HASH JOIN | | 4 | 436 | 122 (1)| 00:00:02 |
| 23 | NESTED LOOPS | | | | | |
| 24 | NESTED LOOPS | | 4 | 388 | 103 (0)| 00:00:02 |
| 25 | NESTED LOOPS | | 23 | 1449 | 57 (0)| 00:00:01 |
| 26 | TABLE ACCESS BY INDEX ROWID | TB201308_CONGOODSBILL | 23 | 667 | 4 (0)| 00:00:01 |
|* 27 | INDEX RANGE SCAN | IDX_201308EXECUTEDATE | 23 | | 3 (0)| 00:00:01 |
|* 28 | TABLE ACCESS BY INDEX ROWID | TB201308_DEPTCONGOODS | 1 | 34 | 5 (0)| 00:00:01 |
|* 29 | INDEX RANGE SCAN | IDX201308DEPTCONGOODS | 57 | | 2 (0)| 00:00:01 |
|* 30 | INDEX UNIQUE SCAN | PK_TB201308_CONGOODSDETAIL | 1 | | 1 (0)| 00:00:01 |
| 31 | TABLE ACCESS BY INDEX ROWID | TB201308_CONGOODSDETAIL | 1 | 34 | 2 (0)| 00:00:01 |
| 32 | TABLE ACCESS FULL | tmp1060 | 16956 | 198K| 18 (0)| 00:00:01 |
| 33 | VIEW | VW_FOJ_1 | 1252 | 22536 | 54909 (1)| 00:10:59 |
|* 34 | HASH JOIN FULL OUTER | | 1252 | 72616 | 54909 (1)| 00:10:59 |
| 35 | VIEW | | 104 | 3016 | 3387 (1)| 00:00:41 |
| 36 | NESTED LOOPS | | | | | |
| 37 | NESTED LOOPS | | 104 | 11336 | 3387 (1)| 00:00:41 |
|* 38 | HASH JOIN | | 788 | 59100 | 1810 (1)| 00:00:22 |
|* 39 | TABLE ACCESS BY INDEX ROWID | TB201309_DEPTCONGOODS | 807 | 27438 | 1328 (1)| 00:00:16 |
|* 40 | INDEX RANGE SCAN | IDX_09$DEPTCODE | 1652 | | 8 (0)| 00:00:01 |
|* 41 | HASH JOIN | | 16956 | 678K| 481 (1)| 00:00:06 |
| 42 | TABLE ACCESS FULL | tmp1060 | 16956 | 198K| 18 (0)| 00:00:01 |
| 43 | TABLE ACCESS BY INDEX ROWID | TB201309_CONGOODSBILL | 17356 | 491K| 462 (1)| 00:00:06 |
|* 44 | INDEX RANGE SCAN | IDX_201309EXECUTEDATE | 17356 | | 71 (0)| 00:00:01 |
|* 45 | INDEX UNIQUE SCAN | PK_TB201309_CONGOODSDETAIL | 1 | | 1 (0)| 00:00:01 |
| 46 | TABLE ACCESS BY INDEX ROWID | TB201309_CONGOODSDETAIL | 1 | 34 | 2 (0)| 00:00:01 |
| 47 | VIEW | | 1252 | 36308 | 51522 (1)| 00:10:19 |
|* 48 | HASH JOIN | | 1252 | 156K| 51522 (1)| 00:10:19 |
| 49 | NESTED LOOPS | | | | | |
| 50 | NESTED LOOPS | | 1252 | 141K| 51503 (1)| 00:10:19 |
|* 51 | HASH JOIN | | 9473 | 758K| 32546 (1)| 00:06:31 |
| 52 | NESTED LOOPS | | | | | |
| 53 | NESTED LOOPS | | 9473 | 490K| 32083 (1)| 00:06:25 |
| 54 | TABLE ACCESS BY INDEX ROWID| TBCATTODEPARTMENT | 16 | 240 | 16 (0)| 00:00:01 |
|* 55 | INDEX RANGE SCAN | IDX$$_3F470002 | 16 | | 1 (0)| 00:00:01 |
|* 56 | INDEX RANGE SCAN | IDX_09$DEPTCODE | 2496 | | 10 (0)| 00:00:01 |
|* 57 | TABLE ACCESS BY INDEX ROWID | TB201309_DEPTCONGOODS | 593 | 22534 | 2004 (1)| 00:00:25 |
| 58 | TABLE ACCESS BY INDEX ROWID | TB201309_CONGOODSBILL | 17356 | 491K| 462 (1)| 00:00:06 |
|* 59 | INDEX RANGE SCAN | IDX_201309EXECUTEDATE | 17356 | | 71 (0)| 00:00:01 |
|* 60 | INDEX UNIQUE SCAN | PK_TB201309_CONGOODSDETAIL | 1 | | 1 (0)| 00:00:01 |
| 61 | TABLE ACCESS BY INDEX ROWID | TB201309_CONGOODSDETAIL | 1 | 34 | 2 (0)| 00:00:01 |
| 62 | TABLE ACCESS FULL | tmp1060 | 16956 | 198K| 18 (0)| 00:00:01 |
|* 63 | INDEX RANGE SCAN | IND_DGSN_GOODSCODE | 168 | | 3 (0)| 00:00:01 |
| 64 | TABLE ACCESS BY INDEX ROWID | tbdgs | 168 | 10416 | 122 (0)| 00:00:02 |
-----------------------------------------------------------------------------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
6 - access("JT"."BILLNUMBER"="FL"."BILLNUMBER" AND "JT"."DEPTCODE"="FL"."DEPTCODE" AND
"JT"."GOODSCODE"="FL"."GOODSCODE")
8 - access("M"."BILLNUMBER"="T"."BILLNUMBER")
14 - access("M"."EXECUTEDATE"='20130924')
15 - filter("G"."DEPTTYPE"=0)
16 - access("M"."BILLNUMBER"="G"."BILLNUMBER")
17 - access("G"."DEPTCODE"="D"."DEPTCATEGORYCODE" AND "G"."CATEGORYITEMCODE"="D"."DEPTCATITEMCODE" AND
"D"."NODECODE"='1329')
18 - access("M"."BILLNUMBER"="E"."BILLNUMBER" AND "G"."MAINGOODSID"="E"."INSIDEID")
22 - access("T"."BILLNUMBER"="M"."BILLNUMBER")
27 - access("M"."EXECUTEDATE"='20130924')
28 - filter("G"."DEPTCODE"='1329' AND "G"."DEPTTYPE"=1)
29 - access("M"."BILLNUMBER"="G"."BILLNUMBER")
30 - access("M"."BILLNUMBER"="E"."BILLNUMBER" AND "G"."MAINGOODSID"="E"."INSIDEID")
34 - access("JT"."BILLNUMBER"="FL"."BILLNUMBER" AND "JT"."DEPTCODE"="FL"."DEPTCODE" AND
"JT"."GOODSCODE"="FL"."GOODSCODE")
38 - access("M"."BILLNUMBER"="G"."BILLNUMBER")
39 - filter("G"."DEPTTYPE"=1)
40 - access("G"."DEPTCODE"='1329')
41 - access("T"."BILLNUMBER"="M"."BILLNUMBER")
44 - access("M"."EXECUTEDATE"='20130924')
45 - access("M"."BILLNUMBER"="E"."BILLNUMBER" AND "G"."MAINGOODSID"="E"."INSIDEID")
48 - access("M"."BILLNUMBER"="T"."BILLNUMBER")
51 - access("M"."BILLNUMBER"="G"."BILLNUMBER")
55 - access("D"."NODECODE"='1329')
56 - access("G"."DEPTCODE"="D"."DEPTCATEGORYCODE")
57 - filter("G"."DEPTTYPE"=0 AND "G"."CATEGORYITEMCODE"="D"."DEPTCATITEMCODE")
59 - access("M"."EXECUTEDATE"='20130924')
60 - access("M"."BILLNUMBER"="E"."BILLNUMBER" AND "G"."MAINGOODSID"="E"."INSIDEID")
63 - access("GS"."GOODSCODE"="GCON"."GOODSCODE")
Note
-----
- dynamic sampling used for this statement (level=2)
Statistics
----------------------------------------------------------
13 recursive calls
0 db block gets
44374 consistent gets
4359 physical reads
0 redo size
3192606 bytes sent via SQL*Net to client
44901 bytes received via SQL*Net from client
3890 SQL*Net roundtrips to/from client
0 sorts (memory)
0 sorts (disk)
58325 rows processed
SQL>
SQL> /
58325 rows selected.
Elapsed: 00:00:07.67
Execution Plan
----------------------------------------------------------
Plan hash value: 1153630427
-----------------------------------------------------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
-----------------------------------------------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 210K| 14M| 208K (1)| 00:41:42 |
| 1 | NESTED LOOPS | | | | | |
| 2 | NESTED LOOPS | | 210K| 14M| 208K (1)| 00:41:42 |
| 3 | VIEW | | 1256 | 11304 | 55113 (1)| 00:11:02 |
| 4 | UNION-ALL | | | | | |
| 5 | VIEW | VW_FOJ_0 | 4 | 72 | 204 (1)| 00:00:03 |
|* 6 | HASH JOIN FULL OUTER | | 4 | 232 | 204 (1)| 00:00:03 |
| 7 | VIEW | | 1 | 29 | 82 (2)| 00:00:01 |
|* 8 | HASH JOIN | | 1 | 128 | 82 (2)| 00:00:01 |
| 9 | NESTED LOOPS | | | | | |
| 10 | NESTED LOOPS | | 1 | 116 | 63 (0)| 00:00:01 |
| 11 | NESTED LOOPS | | 3 | 246 | 57 (0)| 00:00:01 |
| 12 | NESTED LOOPS | | 716 | 47972 | 57 (0)| 00:00:01 |
| 13 | TABLE ACCESS BY INDEX ROWID | TB201308_CONGOODSBILL | 23 | 667 | 4 (0)| 00:00:01 |
|* 14 | INDEX RANGE SCAN | IDX_201308EXECUTEDATE | 23 | | 3 (0)| 00:00:01 |
|* 15 | TABLE ACCESS BY INDEX ROWID | TB201308_DEPTCONGOODS | 31 | 1178 | 5 (0)| 00:00:01 |
|* 16 | INDEX RANGE SCAN | IDX201308DEPTCONGOODS | 57 | | 2 (0)| 00:00:01 |
|* 17 | INDEX UNIQUE SCAN | PK_TBCATTODEPARTMENT | 1 | 15 | 0 (0)| 00:00:01 |
|* 18 | INDEX UNIQUE SCAN | PK_TB201308_CONGOODSDETAIL | 1 | | 1 (0)| 00:00:01 |
| 19 | TABLE ACCESS BY INDEX ROWID | TB201308_CONGOODSDETAIL | 1 | 34 | 2 (0)| 00:00:01 |
| 20 | TABLE ACCESS FULL | tmp1060 | 16956 | 198K| 18 (0)| 00:00:01 |
| 21 | VIEW | | 4 | 116 | 122 (1)| 00:00:02 |
|* 22 | HASH JOIN | | 4 | 436 | 122 (1)| 00:00:02 |
| 23 | NESTED LOOPS | | | | | |
| 24 | NESTED LOOPS | | 4 | 388 | 103 (0)| 00:00:02 |
| 25 | NESTED LOOPS | | 23 | 1449 | 57 (0)| 00:00:01 |
| 26 | TABLE ACCESS BY INDEX ROWID | TB201308_CONGOODSBILL | 23 | 667 | 4 (0)| 00:00:01 |
|* 27 | INDEX RANGE SCAN | IDX_201308EXECUTEDATE | 23 | | 3 (0)| 00:00:01 |
|* 28 | TABLE ACCESS BY INDEX ROWID | TB201308_DEPTCONGOODS | 1 | 34 | 5 (0)| 00:00:01 |
|* 29 | INDEX RANGE SCAN | IDX201308DEPTCONGOODS | 57 | | 2 (0)| 00:00:01 |
|* 30 | INDEX UNIQUE SCAN | PK_TB201308_CONGOODSDETAIL | 1 | | 1 (0)| 00:00:01 |
| 31 | TABLE ACCESS BY INDEX ROWID | TB201308_CONGOODSDETAIL | 1 | 34 | 2 (0)| 00:00:01 |
| 32 | TABLE ACCESS FULL | tmp1060 | 16956 | 198K| 18 (0)| 00:00:01 |
| 33 | VIEW | VW_FOJ_1 | 1252 | 22536 | 54909 (1)| 00:10:59 |
|* 34 | HASH JOIN FULL OUTER | | 1252 | 72616 | 54909 (1)| 00:10:59 |
| 35 | VIEW | | 104 | 3016 | 3387 (1)| 00:00:41 |
| 36 | NESTED LOOPS | | | | | |
| 37 | NESTED LOOPS | | 104 | 11336 | 3387 (1)| 00:00:41 |
|* 38 | HASH JOIN | | 788 | 59100 | 1810 (1)| 00:00:22 |
|* 39 | TABLE ACCESS BY INDEX ROWID | TB201309_DEPTCONGOODS | 807 | 27438 | 1328 (1)| 00:00:16 |
|* 40 | INDEX RANGE SCAN | IDX_09$DEPTCODE | 1652 | | 8 (0)| 00:00:01 |
|* 41 | HASH JOIN | | 16956 | 678K| 481 (1)| 00:00:06 |
| 42 | TABLE ACCESS FULL | tmp1060 | 16956 | 198K| 18 (0)| 00:00:01 |
| 43 | TABLE ACCESS BY INDEX ROWID | TB201309_CONGOODSBILL | 17356 | 491K| 462 (1)| 00:00:06 |
|* 44 | INDEX RANGE SCAN | IDX_201309EXECUTEDATE | 17356 | | 71 (0)| 00:00:01 |
|* 45 | INDEX UNIQUE SCAN | PK_TB201309_CONGOODSDETAIL | 1 | | 1 (0)| 00:00:01 |
| 46 | TABLE ACCESS BY INDEX ROWID | TB201309_CONGOODSDETAIL | 1 | 34 | 2 (0)| 00:00:01 |
| 47 | VIEW | | 1252 | 36308 | 51522 (1)| 00:10:19 |
|* 48 | HASH JOIN | | 1252 | 156K| 51522 (1)| 00:10:19 |
| 49 | NESTED LOOPS | | | | | |
| 50 | NESTED LOOPS | | 1252 | 141K| 51503 (1)| 00:10:19 |
|* 51 | HASH JOIN | | 9473 | 758K| 32546 (1)| 00:06:31 |
| 52 | NESTED LOOPS | | | | | |
| 53 | NESTED LOOPS | | 9473 | 490K| 32083 (1)| 00:06:25 |
| 54 | TABLE ACCESS BY INDEX ROWID| TBCATTODEPARTMENT | 16 | 240 | 16 (0)| 00:00:01 |
|* 55 | INDEX RANGE SCAN | IDX$$_3F470002 | 16 | | 1 (0)| 00:00:01 |
|* 56 | INDEX RANGE SCAN | IDX_09$DEPTCODE | 2496 | | 10 (0)| 00:00:01 |
|* 57 | TABLE ACCESS BY INDEX ROWID | TB201309_DEPTCONGOODS | 593 | 22534 | 2004 (1)| 00:00:25 |
| 58 | TABLE ACCESS BY INDEX ROWID | TB201309_CONGOODSBILL | 17356 | 491K| 462 (1)| 00:00:06 |
|* 59 | INDEX RANGE SCAN | IDX_201309EXECUTEDATE | 17356 | | 71 (0)| 00:00:01 |
|* 60 | INDEX UNIQUE SCAN | PK_TB201309_CONGOODSDETAIL | 1 | | 1 (0)| 00:00:01 |
| 61 | TABLE ACCESS BY INDEX ROWID | TB201309_CONGOODSDETAIL | 1 | 34 | 2 (0)| 00:00:01 |
| 62 | TABLE ACCESS FULL | tmp1060 | 16956 | 198K| 18 (0)| 00:00:01 |
|* 63 | INDEX RANGE SCAN | IND_DGSN_GOODSCODE | 168 | | 3 (0)| 00:00:01 |
| 64 | TABLE ACCESS BY INDEX ROWID | tbdgs | 168 | 10416 | 122 (0)| 00:00:02 |
-----------------------------------------------------------------------------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
6 - access("JT"."BILLNUMBER"="FL"."BILLNUMBER" AND "JT"."DEPTCODE"="FL"."DEPTCODE" AND
"JT"."GOODSCODE"="FL"."GOODSCODE")
8 - access("M"."BILLNUMBER"="T"."BILLNUMBER")
14 - access("M"."EXECUTEDATE"='20130924')
15 - filter("G"."DEPTTYPE"=0)
16 - access("M"."BILLNUMBER"="G"."BILLNUMBER")
17 - access("G"."DEPTCODE"="D"."DEPTCATEGORYCODE" AND "G"."CATEGORYITEMCODE"="D"."DEPTCATITEMCODE" AND
"D"."NODECODE"='1329')
18 - access("M"."BILLNUMBER"="E"."BILLNUMBER" AND "G"."MAINGOODSID"="E"."INSIDEID")
22 - access("T"."BILLNUMBER"="M"."BILLNUMBER")
27 - access("M"."EXECUTEDATE"='20130924')
28 - filter("G"."DEPTCODE"='1329' AND "G"."DEPTTYPE"=1)
29 - access("M"."BILLNUMBER"="G"."BILLNUMBER")
30 - access("M"."BILLNUMBER"="E"."BILLNUMBER" AND "G"."MAINGOODSID"="E"."INSIDEID")
34 - access("JT"."BILLNUMBER"="FL"."BILLNUMBER" AND "JT"."DEPTCODE"="FL"."DEPTCODE" AND
"JT"."GOODSCODE"="FL"."GOODSCODE")
38 - access("M"."BILLNUMBER"="G"."BILLNUMBER")
39 - filter("G"."DEPTTYPE"=1)
40 - access("G"."DEPTCODE"='1329')
41 - access("T"."BILLNUMBER"="M"."BILLNUMBER")
44 - access("M"."EXECUTEDATE"='20130924')
45 - access("M"."BILLNUMBER"="E"."BILLNUMBER" AND "G"."MAINGOODSID"="E"."INSIDEID")
48 - access("M"."BILLNUMBER"="T"."BILLNUMBER")
51 - access("M"."BILLNUMBER"="G"."BILLNUMBER")
55 - access("D"."NODECODE"='1329')
56 - access("G"."DEPTCODE"="D"."DEPTCATEGORYCODE")
57 - filter("G"."DEPTTYPE"=0 AND "G"."CATEGORYITEMCODE"="D"."DEPTCATITEMCODE")
59 - access("M"."EXECUTEDATE"='20130924')
60 - access("M"."BILLNUMBER"="E"."BILLNUMBER" AND "G"."MAINGOODSID"="E"."INSIDEID")
63 - access("GS"."GOODSCODE"="GCON"."GOODSCODE")
Note
-----
- dynamic sampling used for this statement (level=2)
Statistics
----------------------------------------------------------
14 recursive calls
0 db block gets
44708 consistent gets
1675 physical reads
0 redo size
3189216 bytes sent via SQL*Net to client
44901 bytes received via SQL*Net from client
3890 SQL*Net roundtrips to/from client
0 sorts (memory)
0 sorts (disk)
58325 rows processed
SQL>
SQL> /
58325 rows selected.
Elapsed: 00:00:01.52
Execution Plan
----------------------------------------------------------
Plan hash value: 1153630427
-----------------------------------------------------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
-----------------------------------------------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 210K| 14M| 208K (1)| 00:41:42 |
| 1 | NESTED LOOPS | | | | | |
| 2 | NESTED LOOPS | | 210K| 14M| 208K (1)| 00:41:42 |
| 3 | VIEW | | 1256 | 11304 | 55113 (1)| 00:11:02 |
| 4 | UNION-ALL | | | | | |
| 5 | VIEW | VW_FOJ_0 | 4 | 72 | 204 (1)| 00:00:03 |
|* 6 | HASH JOIN FULL OUTER | | 4 | 232 | 204 (1)| 00:00:03 |
| 7 | VIEW | | 1 | 29 | 82 (2)| 00:00:01 |
|* 8 | HASH JOIN | | 1 | 128 | 82 (2)| 00:00:01 |
| 9 | NESTED LOOPS | | | | | |
| 10 | NESTED LOOPS | | 1 | 116 | 63 (0)| 00:00:01 |
| 11 | NESTED LOOPS | | 3 | 246 | 57 (0)| 00:00:01 |
| 12 | NESTED LOOPS | | 716 | 47972 | 57 (0)| 00:00:01 |
| 13 | TABLE ACCESS BY INDEX ROWID | TB201308_CONGOODSBILL | 23 | 667 | 4 (0)| 00:00:01 |
|* 14 | INDEX RANGE SCAN | IDX_201308EXECUTEDATE | 23 | | 3 (0)| 00:00:01 |
|* 15 | TABLE ACCESS BY INDEX ROWID | TB201308_DEPTCONGOODS | 31 | 1178 | 5 (0)| 00:00:01 |
|* 16 | INDEX RANGE SCAN | IDX201308DEPTCONGOODS | 57 | | 2 (0)| 00:00:01 |
|* 17 | INDEX UNIQUE SCAN | PK_TBCATTODEPARTMENT | 1 | 15 | 0 (0)| 00:00:01 |
|* 18 | INDEX UNIQUE SCAN | PK_TB201308_CONGOODSDETAIL | 1 | | 1 (0)| 00:00:01 |
| 19 | TABLE ACCESS BY INDEX ROWID | TB201308_CONGOODSDETAIL | 1 | 34 | 2 (0)| 00:00:01 |
| 20 | TABLE ACCESS FULL | tmp1060 | 16956 | 198K| 18 (0)| 00:00:01 |
| 21 | VIEW | | 4 | 116 | 122 (1)| 00:00:02 |
|* 22 | HASH JOIN | | 4 | 436 | 122 (1)| 00:00:02 |
| 23 | NESTED LOOPS | | | | | |
| 24 | NESTED LOOPS | | 4 | 388 | 103 (0)| 00:00:02 |
| 25 | NESTED LOOPS | | 23 | 1449 | 57 (0)| 00:00:01 |
| 26 | TABLE ACCESS BY INDEX ROWID | TB201308_CONGOODSBILL | 23 | 667 | 4 (0)| 00:00:01 |
|* 27 | INDEX RANGE SCAN | IDX_201308EXECUTEDATE | 23 | | 3 (0)| 00:00:01 |
|* 28 | TABLE ACCESS BY INDEX ROWID | TB201308_DEPTCONGOODS | 1 | 34 | 5 (0)| 00:00:01 |
|* 29 | INDEX RANGE SCAN | IDX201308DEPTCONGOODS | 57 | | 2 (0)| 00:00:01 |
|* 30 | INDEX UNIQUE SCAN | PK_TB201308_CONGOODSDETAIL | 1 | | 1 (0)| 00:00:01 |
| 31 | TABLE ACCESS BY INDEX ROWID | TB201308_CONGOODSDETAIL | 1 | 34 | 2 (0)| 00:00:01 |
| 32 | TABLE ACCESS FULL | tmp1060 | 16956 | 198K| 18 (0)| 00:00:01 |
| 33 | VIEW | VW_FOJ_1 | 1252 | 22536 | 54909 (1)| 00:10:59 |
|* 34 | HASH JOIN FULL OUTER | | 1252 | 72616 | 54909 (1)| 00:10:59 |
| 35 | VIEW | | 104 | 3016 | 3387 (1)| 00:00:41 |
| 36 | NESTED LOOPS | | | | | |
| 37 | NESTED LOOPS | | 104 | 11336 | 3387 (1)| 00:00:41 |
|* 38 | HASH JOIN | | 788 | 59100 | 1810 (1)| 00:00:22 |
|* 39 | TABLE ACCESS BY INDEX ROWID | TB201309_DEPTCONGOODS | 807 | 27438 | 1328 (1)| 00:00:16 |
|* 40 | INDEX RANGE SCAN | IDX_09$DEPTCODE | 1652 | | 8 (0)| 00:00:01 |
|* 41 | HASH JOIN | | 16956 | 678K| 481 (1)| 00:00:06 |
| 42 | TABLE ACCESS FULL | tmp1060 | 16956 | 198K| 18 (0)| 00:00:01 |
| 43 | TABLE ACCESS BY INDEX ROWID | TB201309_CONGOODSBILL | 17356 | 491K| 462 (1)| 00:00:06 |
|* 44 | INDEX RANGE SCAN | IDX_201309EXECUTEDATE | 17356 | | 71 (0)| 00:00:01 |
|* 45 | INDEX UNIQUE SCAN | PK_TB201309_CONGOODSDETAIL | 1 | | 1 (0)| 00:00:01 |
| 46 | TABLE ACCESS BY INDEX ROWID | TB201309_CONGOODSDETAIL | 1 | 34 | 2 (0)| 00:00:01 |
| 47 | VIEW | | 1252 | 36308 | 51522 (1)| 00:10:19 |
|* 48 | HASH JOIN | | 1252 | 156K| 51522 (1)| 00:10:19 |
| 49 | NESTED LOOPS | | | | | |
| 50 | NESTED LOOPS | | 1252 | 141K| 51503 (1)| 00:10:19 |
|* 51 | HASH JOIN | | 9473 | 758K| 32546 (1)| 00:06:31 |
| 52 | NESTED LOOPS | | | | | |
| 53 | NESTED LOOPS | | 9473 | 490K| 32083 (1)| 00:06:25 |
| 54 | TABLE ACCESS BY INDEX ROWID| TBCATTODEPARTMENT | 16 | 240 | 16 (0)| 00:00:01 |
|* 55 | INDEX RANGE SCAN | IDX$$_3F470002 | 16 | | 1 (0)| 00:00:01 |
|* 56 | INDEX RANGE SCAN | IDX_09$DEPTCODE | 2496 | | 10 (0)| 00:00:01 |
|* 57 | TABLE ACCESS BY INDEX ROWID | TB201309_DEPTCONGOODS | 593 | 22534 | 2004 (1)| 00:00:25 |
| 58 | TABLE ACCESS BY INDEX ROWID | TB201309_CONGOODSBILL | 17356 | 491K| 462 (1)| 00:00:06 |
|* 59 | INDEX RANGE SCAN | IDX_201309EXECUTEDATE | 17356 | | 71 (0)| 00:00:01 |
|* 60 | INDEX UNIQUE SCAN | PK_TB201309_CONGOODSDETAIL | 1 | | 1 (0)| 00:00:01 |
| 61 | TABLE ACCESS BY INDEX ROWID | TB201309_CONGOODSDETAIL | 1 | 34 | 2 (0)| 00:00:01 |
| 62 | TABLE ACCESS FULL | tmp1060 | 16956 | 198K| 18 (0)| 00:00:01 |
|* 63 | INDEX RANGE SCAN | IND_DGSN_GOODSCODE | 168 | | 3 (0)| 00:00:01 |
| 64 | TABLE ACCESS BY INDEX ROWID | tbdgs | 168 | 10416 | 122 (0)| 00:00:02 |
-----------------------------------------------------------------------------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
6 - access("JT"."BILLNUMBER"="FL"."BILLNUMBER" AND "JT"."DEPTCODE"="FL"."DEPTCODE" AND
"JT"."GOODSCODE"="FL"."GOODSCODE")
8 - access("M"."BILLNUMBER"="T"."BILLNUMBER")
14 - access("M"."EXECUTEDATE"='20130924')
15 - filter("G"."DEPTTYPE"=0)
16 - access("M"."BILLNUMBER"="G"."BILLNUMBER")
17 - access("G"."DEPTCODE"="D"."DEPTCATEGORYCODE" AND "G"."CATEGORYITEMCODE"="D"."DEPTCATITEMCODE" AND
"D"."NODECODE"='1329')
18 - access("M"."BILLNUMBER"="E"."BILLNUMBER" AND "G"."MAINGOODSID"="E"."INSIDEID")
22 - access("T"."BILLNUMBER"="M"."BILLNUMBER")
27 - access("M"."EXECUTEDATE"='20130924')
28 - filter("G"."DEPTCODE"='1329' AND "G"."DEPTTYPE"=1)
29 - access("M"."BILLNUMBER"="G"."BILLNUMBER")
30 - access("M"."BILLNUMBER"="E"."BILLNUMBER" AND "G"."MAINGOODSID"="E"."INSIDEID")
34 - access("JT"."BILLNUMBER"="FL"."BILLNUMBER" AND "JT"."DEPTCODE"="FL"."DEPTCODE" AND
"JT"."GOODSCODE"="FL"."GOODSCODE")
38 - access("M"."BILLNUMBER"="G"."BILLNUMBER")
39 - filter("G"."DEPTTYPE"=1)
40 - access("G"."DEPTCODE"='1329')
41 - access("T"."BILLNUMBER"="M"."BILLNUMBER")
44 - access("M"."EXECUTEDATE"='20130924')
45 - access("M"."BILLNUMBER"="E"."BILLNUMBER" AND "G"."MAINGOODSID"="E"."INSIDEID")
48 - access("M"."BILLNUMBER"="T"."BILLNUMBER")
51 - access("M"."BILLNUMBER"="G"."BILLNUMBER")
55 - access("D"."NODECODE"='1329')
56 - access("G"."DEPTCODE"="D"."DEPTCATEGORYCODE")
57 - filter("G"."DEPTTYPE"=0 AND "G"."CATEGORYITEMCODE"="D"."DEPTCATITEMCODE")
59 - access("M"."EXECUTEDATE"='20130924')
60 - access("M"."BILLNUMBER"="E"."BILLNUMBER" AND "G"."MAINGOODSID"="E"."INSIDEID")
63 - access("GS"."GOODSCODE"="GCON"."GOODSCODE")
Note
-----
- dynamic sampling used for this statement (level=2)
Statistics
----------------------------------------------------------
0 recursive calls
0 db block gets
44666 consistent gets
8 physical reads
0 redo size
3185649 bytes sent via SQL*Net to client
44901 bytes received via SQL*Net from client
3890 SQL*Net roundtrips to/from client
0 sorts (memory)
0 sorts (disk)
58325 rows processed
SQL>
SQL> /
58325 rows selected.
Elapsed: 00:00:01.65
Execution Plan
----------------------------------------------------------
Plan hash value: 1153630427
-----------------------------------------------------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
-----------------------------------------------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 210K| 14M| 208K (1)| 00:41:42 |
| 1 | NESTED LOOPS | | | | | |
| 2 | NESTED LOOPS | | 210K| 14M| 208K (1)| 00:41:42 |
| 3 | VIEW | | 1256 | 11304 | 55113 (1)| 00:11:02 |
| 4 | UNION-ALL | | | | | |
| 5 | VIEW | VW_FOJ_0 | 4 | 72 | 204 (1)| 00:00:03 |
|* 6 | HASH JOIN FULL OUTER | | 4 | 232 | 204 (1)| 00:00:03 |
| 7 | VIEW | | 1 | 29 | 82 (2)| 00:00:01 |
|* 8 | HASH JOIN | | 1 | 128 | 82 (2)| 00:00:01 |
| 9 | NESTED LOOPS | | | | | |
| 10 | NESTED LOOPS | | 1 | 116 | 63 (0)| 00:00:01 |
| 11 | NESTED LOOPS | | 3 | 246 | 57 (0)| 00:00:01 |
| 12 | NESTED LOOPS | | 716 | 47972 | 57 (0)| 00:00:01 |
| 13 | TABLE ACCESS BY INDEX ROWID | TB201308_CONGOODSBILL | 23 | 667 | 4 (0)| 00:00:01 |
|* 14 | INDEX RANGE SCAN | IDX_201308EXECUTEDATE | 23 | | 3 (0)| 00:00:01 |
|* 15 | TABLE ACCESS BY INDEX ROWID | TB201308_DEPTCONGOODS | 31 | 1178 | 5 (0)| 00:00:01 |
|* 16 | INDEX RANGE SCAN | IDX201308DEPTCONGOODS | 57 | | 2 (0)| 00:00:01 |
|* 17 | INDEX UNIQUE SCAN | PK_TBCATTODEPARTMENT | 1 | 15 | 0 (0)| 00:00:01 |
|* 18 | INDEX UNIQUE SCAN | PK_TB201308_CONGOODSDETAIL | 1 | | 1 (0)| 00:00:01 |
| 19 | TABLE ACCESS BY INDEX ROWID | TB201308_CONGOODSDETAIL | 1 | 34 | 2 (0)| 00:00:01 |
| 20 | TABLE ACCESS FULL | tmp1060 | 16956 | 198K| 18 (0)| 00:00:01 |
| 21 | VIEW | | 4 | 116 | 122 (1)| 00:00:02 |
|* 22 | HASH JOIN | | 4 | 436 | 122 (1)| 00:00:02 |
| 23 | NESTED LOOPS | | | | | |
| 24 | NESTED LOOPS | | 4 | 388 | 103 (0)| 00:00:02 |
| 25 | NESTED LOOPS | | 23 | 1449 | 57 (0)| 00:00:01 |
| 26 | TABLE ACCESS BY INDEX ROWID | TB201308_CONGOODSBILL | 23 | 667 | 4 (0)| 00:00:01 |
|* 27 | INDEX RANGE SCAN | IDX_201308EXECUTEDATE | 23 | | 3 (0)| 00:00:01 |
|* 28 | TABLE ACCESS BY INDEX ROWID | TB201308_DEPTCONGOODS | 1 | 34 | 5 (0)| 00:00:01 |
|* 29 | INDEX RANGE SCAN | IDX201308DEPTCONGOODS | 57 | | 2 (0)| 00:00:01 |
|* 30 | INDEX UNIQUE SCAN | PK_TB201308_CONGOODSDETAIL | 1 | | 1 (0)| 00:00:01 |
| 31 | TABLE ACCESS BY INDEX ROWID | TB201308_CONGOODSDETAIL | 1 | 34 | 2 (0)| 00:00:01 |
| 32 | TABLE ACCESS FULL | tmp1060 | 16956 | 198K| 18 (0)| 00:00:01 |
| 33 | VIEW | VW_FOJ_1 | 1252 | 22536 | 54909 (1)| 00:10:59 |
|* 34 | HASH JOIN FULL OUTER | | 1252 | 72616 | 54909 (1)| 00:10:59 |
| 35 | VIEW | | 104 | 3016 | 3387 (1)| 00:00:41 |
| 36 | NESTED LOOPS | | | | | |
| 37 | NESTED LOOPS | | 104 | 11336 | 3387 (1)| 00:00:41 |
|* 38 | HASH JOIN | | 788 | 59100 | 1810 (1)| 00:00:22 |
|* 39 | TABLE ACCESS BY INDEX ROWID | TB201309_DEPTCONGOODS | 807 | 27438 | 1328 (1)| 00:00:16 |
|* 40 | INDEX RANGE SCAN | IDX_09$DEPTCODE | 1652 | | 8 (0)| 00:00:01 |
|* 41 | HASH JOIN | | 16956 | 678K| 481 (1)| 00:00:06 |
| 42 | TABLE ACCESS FULL | tmp1060 | 16956 | 198K| 18 (0)| 00:00:01 |
| 43 | TABLE ACCESS BY INDEX ROWID | TB201309_CONGOODSBILL | 17356 | 491K| 462 (1)| 00:00:06 |
|* 44 | INDEX RANGE SCAN | IDX_201309EXECUTEDATE | 17356 | | 71 (0)| 00:00:01 |
|* 45 | INDEX UNIQUE SCAN | PK_TB201309_CONGOODSDETAIL | 1 | | 1 (0)| 00:00:01 |
| 46 | TABLE ACCESS BY INDEX ROWID | TB201309_CONGOODSDETAIL | 1 | 34 | 2 (0)| 00:00:01 |
| 47 | VIEW | | 1252 | 36308 | 51522 (1)| 00:10:19 |
|* 48 | HASH JOIN | | 1252 | 156K| 51522 (1)| 00:10:19 |
| 49 | NESTED LOOPS | | | | | |
| 50 | NESTED LOOPS | | 1252 | 141K| 51503 (1)| 00:10:19 |
|* 51 | HASH JOIN | | 9473 | 758K| 32546 (1)| 00:06:31 |
| 52 | NESTED LOOPS | | | | | |
| 53 | NESTED LOOPS | | 9473 | 490K| 32083 (1)| 00:06:25 |
| 54 | TABLE ACCESS BY INDEX ROWID| TBCATTODEPARTMENT | 16 | 240 | 16 (0)| 00:00:01 |
|* 55 | INDEX RANGE SCAN | IDX$$_3F470002 | 16 | | 1 (0)| 00:00:01 |
|* 56 | INDEX RANGE SCAN | IDX_09$DEPTCODE | 2496 | | 10 (0)| 00:00:01 |
|* 57 | TABLE ACCESS BY INDEX ROWID | TB201309_DEPTCONGOODS | 593 | 22534 | 2004 (1)| 00:00:25 |
| 58 | TABLE ACCESS BY INDEX ROWID | TB201309_CONGOODSBILL | 17356 | 491K| 462 (1)| 00:00:06 |
|* 59 | INDEX RANGE SCAN | IDX_201309EXECUTEDATE | 17356 | | 71 (0)| 00:00:01 |
|* 60 | INDEX UNIQUE SCAN | PK_TB201309_CONGOODSDETAIL | 1 | | 1 (0)| 00:00:01 |
| 61 | TABLE ACCESS BY INDEX ROWID | TB201309_CONGOODSDETAIL | 1 | 34 | 2 (0)| 00:00:01 |
| 62 | TABLE ACCESS FULL | tmp1060 | 16956 | 198K| 18 (0)| 00:00:01 |
|* 63 | INDEX RANGE SCAN | IND_DGSN_GOODSCODE | 168 | | 3 (0)| 00:00:01 |
| 64 | TABLE ACCESS BY INDEX ROWID | tbdgs | 168 | 10416 | 122 (0)| 00:00:02 |
-----------------------------------------------------------------------------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
6 - access("JT"."BILLNUMBER"="FL"."BILLNUMBER" AND "JT"."DEPTCODE"="FL"."DEPTCODE" AND
"JT"."GOODSCODE"="FL"."GOODSCODE")
8 - access("M"."BILLNUMBER"="T"."BILLNUMBER")
14 - access("M"."EXECUTEDATE"='20130924')
15 - filter("G"."DEPTTYPE"=0)
16 - access("M"."BILLNUMBER"="G"."BILLNUMBER")
17 - access("G"."DEPTCODE"="D"."DEPTCATEGORYCODE" AND "G"."CATEGORYITEMCODE"="D"."DEPTCATITEMCODE" AND
"D"."NODECODE"='1329')
18 - access("M"."BILLNUMBER"="E"."BILLNUMBER" AND "G"."MAINGOODSID"="E"."INSIDEID")
22 - access("T"."BILLNUMBER"="M"."BILLNUMBER")
27 - access("M"."EXECUTEDATE"='20130924')
28 - filter("G"."DEPTCODE"='1329' AND "G"."DEPTTYPE"=1)
29 - access("M"."BILLNUMBER"="G"."BILLNUMBER")
30 - access("M"."BILLNUMBER"="E"."BILLNUMBER" AND "G"."MAINGOODSID"="E"."INSIDEID")
34 - access("JT"."BILLNUMBER"="FL"."BILLNUMBER" AND "JT"."DEPTCODE"="FL"."DEPTCODE" AND
"JT"."GOODSCODE"="FL"."GOODSCODE")
38 - access("M"."BILLNUMBER"="G"."BILLNUMBER")
39 - filter("G"."DEPTTYPE"=1)
40 - access("G"."DEPTCODE"='1329')
41 - access("T"."BILLNUMBER"="M"."BILLNUMBER")
44 - access("M"."EXECUTEDATE"='20130924')
45 - access("M"."BILLNUMBER"="E"."BILLNUMBER" AND "G"."MAINGOODSID"="E"."INSIDEID")
48 - access("M"."BILLNUMBER"="T"."BILLNUMBER")
51 - access("M"."BILLNUMBER"="G"."BILLNUMBER")
55 - access("D"."NODECODE"='1329')
56 - access("G"."DEPTCODE"="D"."DEPTCATEGORYCODE")
57 - filter("G"."DEPTTYPE"=0 AND "G"."CATEGORYITEMCODE"="D"."DEPTCATITEMCODE")
59 - access("M"."EXECUTEDATE"='20130924')
60 - access("M"."BILLNUMBER"="E"."BILLNUMBER" AND "G"."MAINGOODSID"="E"."INSIDEID")
63 - access("GS"."GOODSCODE"="GCON"."GOODSCODE")
Note
-----
- dynamic sampling used for this statement (level=2)
Statistics
----------------------------------------------------------
14 recursive calls
0 db block gets
44918 consistent gets
0 physical reads
0 redo size
3185649 bytes sent via SQL*Net to client
44901 bytes received via SQL*Net from client
3890 SQL*Net roundtrips to/from client
0 sorts (memory)
0 sorts (disk)
58325 rows processed
SQL>
SQL>
SQL>
SQL> SELECT GS.*
2 From "xxx".tbdgs GS , (Select Coalesce(JT.GoodsCode,FL.GoodsCode) GoodsCode
3 From
4 (
5 Select E.GoodsCode,G.BILLNUMBER,G.MAINGOODSID,G.INSIDEID,G.DEPTTYPE,G.CATEGORYITEMCODE,G.DEPTCODE,G.PRICEMODE,G.PURCHPRICE,G.WITHHOLDINGRATES,G.MAXPURCHPRICE,G.RATE,G.SUPPLYGOODSTIME,G.COUNTERCODE,G.PRICECOMPENSATYPE,G.YPRICEMODE,G.YPURCHPRICE,G.YWITHHOLDINGRATES,G.YHIGHPURCHPRICE,G.SGSUPPLIERRATE,G.VIPSUPPLIERRATE,G.TEMPBEGINDATE,G.TEMPENDDATE,G.TEMPRATE
6 From
7 (select m.BillNumber from "xxx".TB201308_ConGoodsBill M,tmp1060 t where t.BillNumber=m.BillNumber and M.ExecuteDate = '20130924') M,
8 (select G.BILLNUMBER,
9 G.MAINGOODSID,
10 G.INSIDEID,
11 G.DEPTTYPE,
12 G.CATEGORYITEMCODE,
13 G.DEPTCODE,
14 G.PRICEMODE,
15 G.PURCHPRICE,
16 G.WITHHOLDINGRATES,
17 G.MAXPURCHPRICE,
18 G.RATE,
19 G.SUPPLYGOODSTIME,
20 G.COUNTERCODE,
21 G.PRICECOMPENSATYPE,
22 G.YPRICEMODE,
23 G.YPURCHPRICE,
24 G.YWITHHOLDINGRATES,
25 G.YHIGHPURCHPRICE,
26 G.SGSUPPLIERRATE,G.VIPSUPPLIERRATE,
27 G.TempBeginDate,
28 G.TempEndDate,
29 G.TempRate
30 from "xxx".TB201308_DeptConGoods G where G.DeptType = 1 AND G.DeptCode = '1329') G,
31 "xxx".TB201308_ConGoodsDetail E
32 Where M.BillNumber = G.BillNumber
33 And M.BillNumber = E.BillNumber
34 And G.MainGoodsID = E.InsideID
35 ) JT Full Join
36 (
37 Select /*+ index(G IDX_09$DEPTCODE) index(E PK_TB201309_CONGOODSDETAIL) */ E.GoodsCode,G.BILLNUMBER,G.MAINGOODSID,G.INSIDEID,G.DEPTTYPE,G.CATEGORYITEMCODE,G.DEPTCODE,G.PRICEMODE,G.PURCHPRICE,G.WITHHOLDINGRATES,G.MAXPURCHPRICE,G.RATE,G.SUPPLYGOODSTIME,G.COUNTERCODE,G.PRICECOMPENSATYPE,G.YPRICEMODE,G.YPURCHPRICE,G.YWITHHOLDINGRATES,G.YHIGHPURCHPRICE,G.SGSUPPLIERRATE,G.VIPSUPPLIERRATE,G.TEMPBEGINDATE,G.TEMPENDDATE,G.TEMPRATE
38 From
39 ( select m.BillNumber from "xxx".TB201308_ConGoodsBill M,tmp1060 T where m.BillNumber=t.BillNumber AND M.ExecuteDate = '20130924' ) M,
40 "xxx".TB201308_DeptConGoods G ,
41 "xxx".tbCatToDepartment D ,
42 "xxx".TB201308_ConGoodsDetail E
43 Where M.BillNumber = G.BillNumber
44 And M.BillNumber = E.BillNumber
45 And G.DeptType = 0
46 And D.NodeCode = '1329'
47 And G.CategoryItemCode = D.DeptCatItemCode
48 And G.DeptCode = D.DeptCategoryCode
49 And G.MainGoodsID = E.InsideID
50 ) FL On JT.BillNumber = FL.BillNumber And JT.DeptCode = FL.DeptCode And JT.GoodsCode = FL.GoodsCode Union All Select Coalesce(JT.GoodsCode,FL.GoodsCode) GoodsCode
51 From
52 (
53 Select E.GoodsCode,G.BILLNUMBER,G.MAINGOODSID,G.INSIDEID,G.DEPTTYPE,G.CATEGORYITEMCODE,G.DEPTCODE,G.PRICEMODE,G.PURCHPRICE,G.WITHHOLDINGRATES,G.MAXPURCHPRICE,G.RATE,G.SUPPLYGOODSTIME,G.COUNTERCODE,G.PRICECOMPENSATYPE,G.YPRICEMODE,G.YPURCHPRICE,G.YWITHHOLDINGRATES,G.YHIGHPURCHPRICE,G.SGSUPPLIERRATE,G.VIPSUPPLIERRATE,G.TEMPBEGINDATE,G.TEMPENDDATE,G.TEMPRATE
54 From
55 (select m.BillNumber from "xxx".TB201309_ConGoodsBill M,tmp1060 t where t.BillNumber=m.BillNumber and M.ExecuteDate = '20130924') M,
56 (select G.BILLNUMBER,
57 G.MAINGOODSID,
58 G.INSIDEID,
59 G.DEPTTYPE,
60 G.CATEGORYITEMCODE,
61 G.DEPTCODE,
62 G.PRICEMODE,
63 G.PURCHPRICE,
64 G.WITHHOLDINGRATES,
65 G.MAXPURCHPRICE,
66 G.RATE,
67 G.SUPPLYGOODSTIME,
68 G.COUNTERCODE,
69 G.PRICECOMPENSATYPE,
70 G.YPRICEMODE,
71 G.YPURCHPRICE,
72 G.YWITHHOLDINGRATES,
73 G.YHIGHPURCHPRICE,
74 G.SGSUPPLIERRATE,G.VIPSUPPLIERRATE,
75 G.TempBeginDate,
76 G.TempEndDate,
77 G.TempRate
78 from "xxx".TB201309_DeptConGoods G where G.DeptType = 1 AND G.DeptCode = '1329') G,
79 "xxx".TB201309_ConGoodsDetail E
80 Where M.BillNumber = G.BillNumber
81 And M.BillNumber = E.BillNumber
82 And G.MainGoodsID = E.InsideID
83 ) JT Full Join
84 (
85 Select /*+ index(G IDX_09$DEPTCODE) index(E PK_TB201309_CONGOODSDETAIL) */ E.GoodsCode,G.BILLNUMBER,G.MAINGOODSID,G.INSIDEID,G.DEPTTYPE,G.CATEGORYITEMCODE,G.DEPTCODE,G.PRICEMODE,G.PURCHPRICE,G.WITHHOLDINGRATES,G.MAXPURCHPRICE,G.RATE,G.SUPPLYGOODSTIME,G.COUNTERCODE,G.PRICECOMPENSATYPE,G.YPRICEMODE,G.YPURCHPRICE,G.YWITHHOLDINGRATES,G.YHIGHPURCHPRICE,G.SGSUPPLIERRATE,G.VIPSUPPLIERRATE,G.TEMPBEGINDATE,G.TEMPENDDATE,G.TEMPRATE
86 From
87 ( select m.BillNumber from "xxx".TB201309_ConGoodsBill M,tmp1060 T where m.BillNumber=t.BillNumber AND M.ExecuteDate = '20130924' ) M,
88 "xxx".TB201309_DeptConGoods G ,
89 "xxx".tbCatToDepartment D ,
90 "xxx".TB201309_ConGoodsDetail E
91 Where M.BillNumber = G.BillNumber
92 And M.BillNumber = E.BillNumber
93 And G.DeptType = 0
94 And D.NodeCode = '1329'
95 And G.CategoryItemCode = D.DeptCatItemCode
96 And G.DeptCode = D.DeptCategoryCode
97 And G.MainGoodsID = E.InsideID
98 ) FL On JT.BillNumber = FL.BillNumber And JT.DeptCode = FL.DeptCode And JT.GoodsCode = FL.GoodsCode ) GCON
99 Where exists (select 1 from (select 0 DeptType,DeptCategoryCode DeptCode from "xxx".tbCatToDepartment where NodeCode = '1329' and DeptCatItemCode = '0004'
100 union all
101 select 1 DeptType,'1329' DeptCode from dual) depts
102 where GS.DeptCode = depts.DeptCode and GS.DeptType = depts.DeptType
103 )
104 And GS.GoodsCode = GCON.GoodsCode;
287 rows selected.
Elapsed: 00:02:45.07
Execution Plan
----------------------------------------------------------
Plan hash value: 1794864797
----------------------------------------------------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
----------------------------------------------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 59 | 4838 | 60367 (1)| 00:12:05 |
|* 1 | HASH JOIN | | 59 | 4838 | 60367 (1)| 00:12:05 |
| 2 | VIEW | | 1256 | 11304 | 55113 (1)| 00:11:02 |
| 3 | UNION-ALL | | | | | |
| 4 | VIEW | VW_FOJ_0 | 4 | 72 | 204 (1)| 00:00:03 |
|* 5 | HASH JOIN FULL OUTER | | 4 | 232 | 204 (1)| 00:00:03 |
| 6 | VIEW | | 1 | 29 | 82 (2)| 00:00:01 |
|* 7 | HASH JOIN | | 1 | 128 | 82 (2)| 00:00:01 |
| 8 | NESTED LOOPS | | | | | |
| 9 | NESTED LOOPS | | 1 | 116 | 63 (0)| 00:00:01 |
| 10 | NESTED LOOPS | | 3 | 246 | 57 (0)| 00:00:01 |
| 11 | NESTED LOOPS | | 716 | 47972 | 57 (0)| 00:00:01 |
| 12 | TABLE ACCESS BY INDEX ROWID | TB201308_CONGOODSBILL | 23 | 667 | 4 (0)| 00:00:01 |
|* 13 | INDEX RANGE SCAN | IDX_201308EXECUTEDATE | 23 | | 3 (0)| 00:00:01 |
|* 14 | TABLE ACCESS BY INDEX ROWID | TB201308_DEPTCONGOODS | 31 | 1178 | 5 (0)| 00:00:01 |
|* 15 | INDEX RANGE SCAN | IDX201308DEPTCONGOODS | 57 | | 2 (0)| 00:00:01 |
|* 16 | INDEX UNIQUE SCAN | PK_TBCATTODEPARTMENT | 1 | 15 | 0 (0)| 00:00:01 |
|* 17 | INDEX UNIQUE SCAN | PK_TB201308_CONGOODSDETAIL | 1 | | 1 (0)| 00:00:01 |
| 18 | TABLE ACCESS BY INDEX ROWID | TB201308_CONGOODSDETAIL | 1 | 34 | 2 (0)| 00:00:01 |
| 19 | TABLE ACCESS FULL | tmp1060 | 16956 | 198K| 18 (0)| 00:00:01 |
| 20 | VIEW | | 4 | 116 | 122 (1)| 00:00:02 |
|* 21 | HASH JOIN | | 4 | 436 | 122 (1)| 00:00:02 |
| 22 | NESTED LOOPS | | | | | |
| 23 | NESTED LOOPS | | 4 | 388 | 103 (0)| 00:00:02 |
| 24 | NESTED LOOPS | | 23 | 1449 | 57 (0)| 00:00:01 |
| 25 | TABLE ACCESS BY INDEX ROWID | TB201308_CONGOODSBILL | 23 | 667 | 4 (0)| 00:00:01 |
|* 26 | INDEX RANGE SCAN | IDX_201308EXECUTEDATE | 23 | | 3 (0)| 00:00:01 |
|* 27 | TABLE ACCESS BY INDEX ROWID | TB201308_DEPTCONGOODS | 1 | 34 | 5 (0)| 00:00:01 |
|* 28 | INDEX RANGE SCAN | IDX201308DEPTCONGOODS | 57 | | 2 (0)| 00:00:01 |
|* 29 | INDEX UNIQUE SCAN | PK_TB201308_CONGOODSDETAIL | 1 | | 1 (0)| 00:00:01 |
| 30 | TABLE ACCESS BY INDEX ROWID | TB201308_CONGOODSDETAIL | 1 | 34 | 2 (0)| 00:00:01 |
| 31 | TABLE ACCESS FULL | tmp1060 | 16956 | 198K| 18 (0)| 00:00:01 |
| 32 | VIEW | VW_FOJ_1 | 1252 | 22536 | 54909 (1)| 00:10:59 |
|* 33 | HASH JOIN FULL OUTER | | 1252 | 72616 | 54909 (1)| 00:10:59 |
| 34 | VIEW | | 104 | 3016 | 3387 (1)| 00:00:41 |
| 35 | NESTED LOOPS | | | | | |
| 36 | NESTED LOOPS | | 104 | 11336 | 3387 (1)| 00:00:41 |
|* 37 | HASH JOIN | | 788 | 59100 | 1810 (1)| 00:00:22 |
|* 38 | TABLE ACCESS BY INDEX ROWID | TB201309_DEPTCONGOODS | 807 | 27438 | 1328 (1)| 00:00:16 |
|* 39 | INDEX RANGE SCAN | IDX_09$DEPTCODE | 1652 | | 8 (0)| 00:00:01 |
|* 40 | HASH JOIN | | 16956 | 678K| 481 (1)| 00:00:06 |
| 41 | TABLE ACCESS FULL | tmp1060 | 16956 | 198K| 18 (0)| 00:00:01 |
| 42 | TABLE ACCESS BY INDEX ROWID | TB201309_CONGOODSBILL | 17356 | 491K| 462 (1)| 00:00:06 |
|* 43 | INDEX RANGE SCAN | IDX_201309EXECUTEDATE | 17356 | | 71 (0)| 00:00:01 |
|* 44 | INDEX UNIQUE SCAN | PK_TB201309_CONGOODSDETAIL | 1 | | 1 (0)| 00:00:01 |
| 45 | TABLE ACCESS BY INDEX ROWID | TB201309_CONGOODSDETAIL | 1 | 34 | 2 (0)| 00:00:01 |
| 46 | VIEW | | 1252 | 36308 | 51522 (1)| 00:10:19 |
|* 47 | HASH JOIN | | 1252 | 156K| 51522 (1)| 00:10:19 |
| 48 | NESTED LOOPS | | | | | |
| 49 | NESTED LOOPS | | 1252 | 141K| 51503 (1)| 00:10:19 |
|* 50 | HASH JOIN | | 9473 | 758K| 32546 (1)| 00:06:31 |
| 51 | NESTED LOOPS | | | | | |
| 52 | NESTED LOOPS | | 9473 | 490K| 32083 (1)| 00:06:25 |
| 53 | TABLE ACCESS BY INDEX ROWID| TBCATTODEPARTMENT | 16 | 240 | 16 (0)| 00:00:01 |
|* 54 | INDEX RANGE SCAN | IDX$$_3F470002 | 16 | | 1 (0)| 00:00:01 |
|* 55 | INDEX RANGE SCAN | IDX_09$DEPTCODE | 2496 | | 10 (0)| 00:00:01 |
|* 56 | TABLE ACCESS BY INDEX ROWID | TB201309_DEPTCONGOODS | 593 | 22534 | 2004 (1)| 00:00:25 |
| 57 | TABLE ACCESS BY INDEX ROWID | TB201309_CONGOODSBILL | 17356 | 491K| 462 (1)| 00:00:06 |
|* 58 | INDEX RANGE SCAN | IDX_201309EXECUTEDATE | 17356 | | 71 (0)| 00:00:01 |
|* 59 | INDEX UNIQUE SCAN | PK_TB201309_CONGOODSDETAIL | 1 | | 1 (0)| 00:00:01 |
| 60 | TABLE ACCESS BY INDEX ROWID | TB201309_CONGOODSDETAIL | 1 | 34 | 2 (0)| 00:00:01 |
| 61 | TABLE ACCESS FULL | tmp1060 | 16956 | 198K| 18 (0)| 00:00:01 |
| 62 | NESTED LOOPS | | | | | |
| 63 | NESTED LOOPS | | 17780 | 1267K| 5253 (1)| 00:01:04 |
| 64 | VIEW | | 2 | 22 | 18 (0)| 00:00:01 |
| 65 | HASH UNIQUE | | 1 | 15 | 18 (12)| 00:00:01 |
| 66 | UNION-ALL | | | | | |
|* 67 | TABLE ACCESS BY INDEX ROWID | TBCATTODEPARTMENT | 1 | 15 | 16 (0)| 00:00:01 |
|* 68 | INDEX RANGE SCAN | IDX$$_3F470002 | 16 | | 1 (0)| 00:00:01 |
| 69 | FAST DUAL | | 1 | | 2 (0)| 00:00:01 |
|* 70 | INDEX RANGE SCAN | INDDEPTTYPECODE | 17780 | | 575 (1)| 00:00:07 |
| 71 | TABLE ACCESS BY INDEX ROWID | tbdgs | 17780 | 1076K| 5234 (1)| 00:01:03 |
----------------------------------------------------------------------------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
1 - access("GS"."GOODSCODE"="GCON"."GOODSCODE")
5 - access("JT"."BILLNUMBER"="FL"."BILLNUMBER" AND "JT"."DEPTCODE"="FL"."DEPTCODE" AND
"JT"."GOODSCODE"="FL"."GOODSCODE")
7 - access("M"."BILLNUMBER"="T"."BILLNUMBER")
13 - access("M"."EXECUTEDATE"='20130924')
14 - filter("G"."DEPTTYPE"=0)
15 - access("M"."BILLNUMBER"="G"."BILLNUMBER")
16 - access("G"."DEPTCODE"="D"."DEPTCATEGORYCODE" AND "G"."CATEGORYITEMCODE"="D"."DEPTCATITEMCODE" AND
"D"."NODECODE"='1329')
17 - access("M"."BILLNUMBER"="E"."BILLNUMBER" AND "G"."MAINGOODSID"="E"."INSIDEID")
21 - access("T"."BILLNUMBER"="M"."BILLNUMBER")
26 - access("M"."EXECUTEDATE"='20130924')
27 - filter("G"."DEPTCODE"='1329' AND "G"."DEPTTYPE"=1)
28 - access("M"."BILLNUMBER"="G"."BILLNUMBER")
29 - access("M"."BILLNUMBER"="E"."BILLNUMBER" AND "G"."MAINGOODSID"="E"."INSIDEID")
33 - access("JT"."BILLNUMBER"="FL"."BILLNUMBER" AND "JT"."DEPTCODE"="FL"."DEPTCODE" AND
"JT"."GOODSCODE"="FL"."GOODSCODE")
37 - access("M"."BILLNUMBER"="G"."BILLNUMBER")
38 - filter("G"."DEPTTYPE"=1)
39 - access("G"."DEPTCODE"='1329')
40 - access("T"."BILLNUMBER"="M"."BILLNUMBER")
43 - access("M"."EXECUTEDATE"='20130924')
44 - access("M"."BILLNUMBER"="E"."BILLNUMBER" AND "G"."MAINGOODSID"="E"."INSIDEID")
47 - access("M"."BILLNUMBER"="T"."BILLNUMBER")
50 - access("M"."BILLNUMBER"="G"."BILLNUMBER")
54 - access("D"."NODECODE"='1329')
55 - access("G"."DEPTCODE"="D"."DEPTCATEGORYCODE")
56 - filter("G"."DEPTTYPE"=0 AND "G"."CATEGORYITEMCODE"="D"."DEPTCATITEMCODE")
58 - access("M"."EXECUTEDATE"='20130924')
59 - access("M"."BILLNUMBER"="E"."BILLNUMBER" AND "G"."MAINGOODSID"="E"."INSIDEID")
67 - filter("DEPTCATITEMCODE"='0004')
68 - access("NODECODE"='1329')
70 - access("GS"."DEPTTYPE"="DEPTS"."DEPTTYPE" AND "GS"."DEPTCODE"="DEPTS"."DEPTCODE")
Note
-----
- dynamic sampling used for this statement (level=2)
Statistics
----------------------------------------------------------
13 recursive calls
0 db block gets
102509 consistent gets
14545 physical reads
0 redo size
19914 bytes sent via SQL*Net to client
728 bytes received via SQL*Net from client
21 SQL*Net roundtrips to/from client
0 sorts (memory)
0 sorts (disk)
287 rows processed
SQL> SELECT GS.*
2 FROM "xxx".tbdgs GS,
3 (SELECT COALESCE (JT.GoodsCode, FL.GoodsCode) GoodsCode
4 FROM (SELECT E.GoodsCode,
5 G.BILLNUMBER,
6 G.MAINGOODSID,
7 G.INSIDEID,
8 G.DEPTTYPE,
9 G.CATEGORYITEMCODE,
10 G.DEPTCODE,
11 G.PRICEMODE,
12 G.PURCHPRICE,
13 G.WITHHOLDINGRATES,
14 G.MAXPURCHPRICE,
15 G.RATE,
16 G.SUPPLYGOODSTIME,
17 G.COUNTERCODE,
18 G.PRICECOMPENSATYPE,
19 G.YPRICEMODE,
20 G.YPURCHPRICE,
21 G.YWITHHOLDINGRATES,
22 G.YHIGHPURCHPRICE,
23 G.SGSUPPLIERRATE,
24 G.VIPSUPPLIERRATE,
25 G.TEMPBEGINDATE,
26 G.TEMPENDDATE,
27 G.TEMPRATE
28 FROM (SELECT m.BillNumber
29 FROM "xxx".TB201308_ConGoodsBill M, tmp1060 t
30 WHERE t.BillNumber = m.BillNumber
31 AND M.ExecuteDate = '20130924') M,
32 (SELECT G.BILLNUMBER,
33 G.MAINGOODSID,
34 G.INSIDEID,
35 G.DEPTTYPE,
36 G.CATEGORYITEMCODE,
37 G.DEPTCODE,
38 G.PRICEMODE,
39 G.PURCHPRICE,
40 G.WITHHOLDINGRATES,
41 G.MAXPURCHPRICE,
42 G.RATE,
43 G.SUPPLYGOODSTIME,
44 G.COUNTERCODE,
45 G.PRICECOMPENSATYPE,
46 G.YPRICEMODE,
47 G.YPURCHPRICE,
48 G.YWITHHOLDINGRATES,
49 G.YHIGHPURCHPRICE,
50 G.SGSUPPLIERRATE,
51 G.VIPSUPPLIERRATE,
52 G.TempBeginDate,
53 G.TempEndDate,
54 G.TempRate
55 FROM "xxx".TB201308_DeptConGoods G
56 WHERE G.DeptType = 1 AND G.DeptCode = '1329') G,
57 "xxx".TB201308_ConGoodsDetail E
58 WHERE M.BillNumber = G.BillNumber
59 AND M.BillNumber = E.BillNumber
60 AND G.MainGoodsID = E.InsideID) JT
61 FULL JOIN
62 (SELECT /*+ index(G IDX_09$DEPTCODE) index(E PK_TB201309_CONGOODSDETAIL) */
63 E.GoodsCode,
64 G.BILLNUMBER,
65 G.MAINGOODSID,
66 G.INSIDEID,
67 G.DEPTTYPE,
68 G.CATEGORYITEMCODE,
69 G.DEPTCODE,
70 G.PRICEMODE,
71 G.PURCHPRICE,
72 G.WITHHOLDINGRATES,
73 G.MAXPURCHPRICE,
74 G.RATE,
75 G.SUPPLYGOODSTIME,
76 G.COUNTERCODE,
77 G.PRICECOMPENSATYPE,
78 G.YPRICEMODE,
79 G.YPURCHPRICE,
80 G.YWITHHOLDINGRATES,
81 G.YHIGHPURCHPRICE,
82 G.SGSUPPLIERRATE,
83 G.VIPSUPPLIERRATE,
84 G.TEMPBEGINDATE,
85 G.TEMPENDDATE,
86 G.TEMPRATE
87 FROM (SELECT m.BillNumber
88 FROM "xxx".TB201308_ConGoodsBill M, tmp1060 T
89 WHERE m.BillNumber = t.BillNumber
90 AND M.ExecuteDate = '20130924') M,
91 "xxx".TB201308_DeptConGoods G,
92 "xxx".tbCatToDepartment D,
93 "xxx".TB201308_ConGoodsDetail E
94 WHERE M.BillNumber = G.BillNumber
95 AND M.BillNumber = E.BillNumber
96 AND G.DeptType = 0
97 AND D.NodeCode = '1329'
98 AND G.CategoryItemCode = D.DeptCatItemCode
99 AND G.DeptCode = D.DeptCategoryCode
100 AND G.MainGoodsID = E.InsideID) FL
101 ON JT.BillNumber = FL.BillNumber
102 AND JT.DeptCode = FL.DeptCode
103 AND JT.GoodsCode = FL.GoodsCode
104 UNION ALL
105 SELECT COALESCE (JT.GoodsCode, FL.GoodsCode) GoodsCode
106 FROM (SELECT E.GoodsCode,
107 G.BILLNUMBER,
108 G.MAINGOODSID,
109 G.INSIDEID,
G.DEPTTYPE,
110 111 G.CATEGORYITEMCODE,
112 G.DEPTCODE,
113 G.PRICEMODE,
114 G.PURCHPRICE,
115 G.WITHHOLDINGRATES,
116 G.MAXPURCHPRICE,
117 G.RATE,
G.SUPPLYGOODSTIME,
118 119 G.COUNTERCODE,
120 G.PRICECOMPENSATYPE,
121 G.YPRICEMODE,
122 G.YPURCHPRICE,
123 G.YWITHHOLDINGRATES,
124 G.YHIGHPURCHPRICE,
125 G.SGSUPPLIERRATE,
126 G.VIPSUPPLIERRATE,
127 G.TEMPBEGINDATE,
128 G.TEMPENDDATE,
129 G.TEMPRATE
130 FROM (SELECT m.BillNumber
131 FROM "xxx".TB201309_ConGoodsBill M, tmp1060 t
132 WHERE t.BillNumber = m.BillNumber
133 AND M.ExecuteDate = '20130924') M,
134 (SELECT G.BILLNUMBER,
135 G.MAINGOODSID,
136 G.INSIDEID,
137 G.DEPTTYPE,
138 G.CATEGORYITEMCODE,
139 G.DEPTCODE,
140 G.PRICEMODE,
141 G.PURCHPRICE,
142 G.WITHHOLDINGRATES,
143 G.MAXPURCHPRICE,
144 G.RATE,
145 G.SUPPLYGOODSTIME,
146 G.COUNTERCODE,
147 G.PRICECOMPENSATYPE,
148 G.YPRICEMODE,
149 G.YPURCHPRICE,
150 G.YWITHHOLDINGRATES,
151 G.YHIGHPURCHPRICE,
152 G.SGSUPPLIERRATE,
153 G.VIPSUPPLIERRATE,
154 G.TempBeginDate,
155 G.TempEndDate,
156 G.TempRate
157 FROM "xxx".TB201309_DeptConGoods G
158 WHERE G.DeptType = 1 AND G.DeptCode = '1329') G,
159 "xxx".TB201309_ConGoodsDetail E
160 WHERE M.BillNumber = G.BillNumber
161 AND M.BillNumber = E.BillNumber
162 AND G.MainGoodsID = E.InsideID) JT
163 FULL JOIN
164 (SELECT /*+ index(G IDX_09$DEPTCODE) index(E PK_TB201309_CONGOODSDETAIL) */
165 E.GoodsCode,
166 G.BILLNUMBER,
167 G.MAINGOODSID,
168 G.INSIDEID,
169 G.DEPTTYPE,
170 G.CATEGORYITEMCODE,
171 G.DEPTCODE,
172 G.PRICEMODE,
173 G.PURCHPRICE,
174 G.WITHHOLDINGRATES,
175 G.MAXPURCHPRICE,
176 G.RATE,
177 G.SUPPLYGOODSTIME,
178 G.COUNTERCODE,
179 G.PRICECOMPENSATYPE,
180 G.YPRICEMODE,
181 G.YPURCHPRICE,
182 G.YWITHHOLDINGRATES,
183 G.YHIGHPURCHPRICE,
184 G.SGSUPPLIERRATE,
185 G.VIPSUPPLIERRATE,
186 G.TEMPBEGINDATE,
187 G.TEMPENDDATE,
188 G.TEMPRATE
189 FROM (SELECT m.BillNumber
190 FROM "xxx".TB201309_ConGoodsBill M, tmp1060 T
191 WHERE m.BillNumber = t.BillNumber
192 AND M.ExecuteDate = '20130924') M,
193 "xxx".TB201309_DeptConGoods G,
194 "xxx".tbCatToDepartment D,
195 "xxx".TB201309_ConGoodsDetail E
196 WHERE M.BillNumber = G.BillNumber
197 AND M.BillNumber = E.BillNumber
198 AND G.DeptType = 0
199 AND D.NodeCode = '1329'
200 AND G.CategoryItemCode = D.DeptCatItemCode
201 AND G.DeptCode = D.DeptCategoryCode
202 AND G.MainGoodsID = E.InsideID) FL
203 ON JT.BillNumber = FL.BillNumber
204 AND JT.DeptCode = FL.DeptCode
205 AND JT.GoodsCode = FL.GoodsCode) GCON
206 WHERE EXISTS
207 (SELECT /*+ hash_sj(GS depts) */ 1
208 FROM (SELECT 0 DeptType, DeptCategoryCode DeptCode
209 FROM "xxx".tbCatToDepartment
210 WHERE NodeCode = '1329' AND DeptCatItemCode = '0004'
211 UNION ALL
212 SELECT 1 DeptType, '1329' DeptCode FROM DUAL) depts
213 WHERE GS.DeptCode = depts.DeptCode
214 AND GS.DeptType = depts.DeptType)
215 AND GS.GoodsCode = GCON.GoodsCode;
287 rows selected.
Elapsed: 00:02:11.81
Execution Plan
----------------------------------------------------------
Plan hash value: 1794864797
----------------------------------------------------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
----------------------------------------------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 59 | 4838 | 60367 (1)| 00:12:05 |
|* 1 | HASH JOIN | | 59 | 4838 | 60367 (1)| 00:12:05 |
| 2 | VIEW | | 1256 | 11304 | 55113 (1)| 00:11:02 |
| 3 | UNION-ALL | | | | | |
| 4 | VIEW | VW_FOJ_0 | 4 | 72 | 204 (1)| 00:00:03 |
|* 5 | HASH JOIN FULL OUTER | | 4 | 232 | 204 (1)| 00:00:03 |
| 6 | VIEW | | 1 | 29 | 82 (2)| 00:00:01 |
|* 7 | HASH JOIN | | 1 | 128 | 82 (2)| 00:00:01 |
| 8 | NESTED LOOPS | | | | | |
| 9 | NESTED LOOPS | | 1 | 116 | 63 (0)| 00:00:01 |
| 10 | NESTED LOOPS | | 3 | 246 | 57 (0)| 00:00:01 |
| 11 | NESTED LOOPS | | 716 | 47972 | 57 (0)| 00:00:01 |
| 12 | TABLE ACCESS BY INDEX ROWID | TB201308_CONGOODSBILL | 23 | 667 | 4 (0)| 00:00:01 |
|* 13 | INDEX RANGE SCAN | IDX_201308EXECUTEDATE | 23 | | 3 (0)| 00:00:01 |
|* 14 | TABLE ACCESS BY INDEX ROWID | TB201308_DEPTCONGOODS | 31 | 1178 | 5 (0)| 00:00:01 |
|* 15 | INDEX RANGE SCAN | IDX201308DEPTCONGOODS | 57 | | 2 (0)| 00:00:01 |
|* 16 | INDEX UNIQUE SCAN | PK_TBCATTODEPARTMENT | 1 | 15 | 0 (0)| 00:00:01 |
|* 17 | INDEX UNIQUE SCAN | PK_TB201308_CONGOODSDETAIL | 1 | | 1 (0)| 00:00:01 |
| 18 | TABLE ACCESS BY INDEX ROWID | TB201308_CONGOODSDETAIL | 1 | 34 | 2 (0)| 00:00:01 |
| 19 | TABLE ACCESS FULL | tmp1060 | 16956 | 198K| 18 (0)| 00:00:01 |
| 20 | VIEW | | 4 | 116 | 122 (1)| 00:00:02 |
|* 21 | HASH JOIN | | 4 | 436 | 122 (1)| 00:00:02 |
| 22 | NESTED LOOPS | | | | | |
| 23 | NESTED LOOPS | | 4 | 388 | 103 (0)| 00:00:02 |
| 24 | NESTED LOOPS | | 23 | 1449 | 57 (0)| 00:00:01 |
| 25 | TABLE ACCESS BY INDEX ROWID | TB201308_CONGOODSBILL | 23 | 667 | 4 (0)| 00:00:01 |
|* 26 | INDEX RANGE SCAN | IDX_201308EXECUTEDATE | 23 | | 3 (0)| 00:00:01 |
|* 27 | TABLE ACCESS BY INDEX ROWID | TB201308_DEPTCONGOODS | 1 | 34 | 5 (0)| 00:00:01 |
|* 28 | INDEX RANGE SCAN | IDX201308DEPTCONGOODS | 57 | | 2 (0)| 00:00:01 |
|* 29 | INDEX UNIQUE SCAN | PK_TB201308_CONGOODSDETAIL | 1 | | 1 (0)| 00:00:01 |
| 30 | TABLE ACCESS BY INDEX ROWID | TB201308_CONGOODSDETAIL | 1 | 34 | 2 (0)| 00:00:01 |
| 31 | TABLE ACCESS FULL | tmp1060 | 16956 | 198K| 18 (0)| 00:00:01 |
| 32 | VIEW | VW_FOJ_1 | 1252 | 22536 | 54909 (1)| 00:10:59 |
|* 33 | HASH JOIN FULL OUTER | | 1252 | 72616 | 54909 (1)| 00:10:59 |
| 34 | VIEW | | 104 | 3016 | 3387 (1)| 00:00:41 |
| 35 | NESTED LOOPS | | | | | |
| 36 | NESTED LOOPS | | 104 | 11336 | 3387 (1)| 00:00:41 |
|* 37 | HASH JOIN | | 788 | 59100 | 1810 (1)| 00:00:22 |
|* 38 | TABLE ACCESS BY INDEX ROWID | TB201309_DEPTCONGOODS | 807 | 27438 | 1328 (1)| 00:00:16 |
|* 39 | INDEX RANGE SCAN | IDX_09$DEPTCODE | 1652 | | 8 (0)| 00:00:01 |
|* 40 | HASH JOIN | | 16956 | 678K| 481 (1)| 00:00:06 |
| 41 | TABLE ACCESS FULL | tmp1060 | 16956 | 198K| 18 (0)| 00:00:01 |
| 42 | TABLE ACCESS BY INDEX ROWID | TB201309_CONGOODSBILL | 17356 | 491K| 462 (1)| 00:00:06 |
|* 43 | INDEX RANGE SCAN | IDX_201309EXECUTEDATE | 17356 | | 71 (0)| 00:00:01 |
|* 44 | INDEX UNIQUE SCAN | PK_TB201309_CONGOODSDETAIL | 1 | | 1 (0)| 00:00:01 |
| 45 | TABLE ACCESS BY INDEX ROWID | TB201309_CONGOODSDETAIL | 1 | 34 | 2 (0)| 00:00:01 |
| 46 | VIEW | | 1252 | 36308 | 51522 (1)| 00:10:19 |
|* 47 | HASH JOIN | | 1252 | 156K| 51522 (1)| 00:10:19 |
| 48 | NESTED LOOPS | | | | | |
| 49 | NESTED LOOPS | | 1252 | 141K| 51503 (1)| 00:10:19 |
|* 50 | HASH JOIN | | 9473 | 758K| 32546 (1)| 00:06:31 |
| 51 | NESTED LOOPS | | | | | |
| 52 | NESTED LOOPS | | 9473 | 490K| 32083 (1)| 00:06:25 |
| 53 | TABLE ACCESS BY INDEX ROWID| TBCATTODEPARTMENT | 16 | 240 | 16 (0)| 00:00:01 |
|* 54 | INDEX RANGE SCAN | IDX$$_3F470002 | 16 | | 1 (0)| 00:00:01 |
|* 55 | INDEX RANGE SCAN | IDX_09$DEPTCODE | 2496 | | 10 (0)| 00:00:01 |
|* 56 | TABLE ACCESS BY INDEX ROWID | TB201309_DEPTCONGOODS | 593 | 22534 | 2004 (1)| 00:00:25 |
| 57 | TABLE ACCESS BY INDEX ROWID | TB201309_CONGOODSBILL | 17356 | 491K| 462 (1)| 00:00:06 |
|* 58 | INDEX RANGE SCAN | IDX_201309EXECUTEDATE | 17356 | | 71 (0)| 00:00:01 |
|* 59 | INDEX UNIQUE SCAN | PK_TB201309_CONGOODSDETAIL | 1 | | 1 (0)| 00:00:01 |
| 60 | TABLE ACCESS BY INDEX ROWID | TB201309_CONGOODSDETAIL | 1 | 34 | 2 (0)| 00:00:01 |
| 61 | TABLE ACCESS FULL | tmp1060 | 16956 | 198K| 18 (0)| 00:00:01 |
| 62 | NESTED LOOPS | | | | | |
| 63 | NESTED LOOPS | | 17780 | 1267K| 5253 (1)| 00:01:04 |
| 64 | VIEW | | 2 | 22 | 18 (0)| 00:00:01 |
| 65 | HASH UNIQUE | | 1 | 15 | 18 (12)| 00:00:01 |
| 66 | UNION-ALL | | | | | |
|* 67 | TABLE ACCESS BY INDEX ROWID | TBCATTODEPARTMENT | 1 | 15 | 16 (0)| 00:00:01 |
|* 68 | INDEX RANGE SCAN | IDX$$_3F470002 | 16 | | 1 (0)| 00:00:01 |
| 69 | FAST DUAL | | 1 | | 2 (0)| 00:00:01 |
|* 70 | INDEX RANGE SCAN | INDDEPTTYPECODE | 17780 | | 575 (1)| 00:00:07 |
| 71 | TABLE ACCESS BY INDEX ROWID | tbdgs | 17780 | 1076K| 5234 (1)| 00:01:03 |
----------------------------------------------------------------------------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
1 - access("GS"."GOODSCODE"="GCON"."GOODSCODE")
5 - access("JT"."BILLNUMBER"="FL"."BILLNUMBER" AND "JT"."DEPTCODE"="FL"."DEPTCODE" AND
"JT"."GOODSCODE"="FL"."GOODSCODE")
7 - access("M"."BILLNUMBER"="T"."BILLNUMBER")
13 - access("M"."EXECUTEDATE"='20130924')
14 - filter("G"."DEPTTYPE"=0)
15 - access("M"."BILLNUMBER"="G"."BILLNUMBER")
16 - access("G"."DEPTCODE"="D"."DEPTCATEGORYCODE" AND "G"."CATEGORYITEMCODE"="D"."DEPTCATITEMCODE" AND
"D"."NODECODE"='1329')
17 - access("M"."BILLNUMBER"="E"."BILLNUMBER" AND "G"."MAINGOODSID"="E"."INSIDEID")
21 - access("T"."BILLNUMBER"="M"."BILLNUMBER")
26 - access("M"."EXECUTEDATE"='20130924')
27 - filter("G"."DEPTCODE"='1329' AND "G"."DEPTTYPE"=1)
28 - access("M"."BILLNUMBER"="G"."BILLNUMBER")
29 - access("M"."BILLNUMBER"="E"."BILLNUMBER" AND "G"."MAINGOODSID"="E"."INSIDEID")
33 - access("JT"."BILLNUMBER"="FL"."BILLNUMBER" AND "JT"."DEPTCODE"="FL"."DEPTCODE" AND
"JT"."GOODSCODE"="FL"."GOODSCODE")
37 - access("M"."BILLNUMBER"="G"."BILLNUMBER")
38 - filter("G"."DEPTTYPE"=1)
39 - access("G"."DEPTCODE"='1329')
40 - access("T"."BILLNUMBER"="M"."BILLNUMBER")
43 - access("M"."EXECUTEDATE"='20130924')
44 - access("M"."BILLNUMBER"="E"."BILLNUMBER" AND "G"."MAINGOODSID"="E"."INSIDEID")
47 - access("M"."BILLNUMBER"="T"."BILLNUMBER")
50 - access("M"."BILLNUMBER"="G"."BILLNUMBER")
54 - access("D"."NODECODE"='1329')
55 - access("G"."DEPTCODE"="D"."DEPTCATEGORYCODE")
56 - filter("G"."DEPTTYPE"=0 AND "G"."CATEGORYITEMCODE"="D"."DEPTCATITEMCODE")
58 - access("M"."EXECUTEDATE"='20130924')
59 - access("M"."BILLNUMBER"="E"."BILLNUMBER" AND "G"."MAINGOODSID"="E"."INSIDEID")
67 - filter("DEPTCATITEMCODE"='0004')
68 - access("NODECODE"='1329')
70 - access("GS"."DEPTTYPE"="DEPTS"."DEPTTYPE" AND "GS"."DEPTCODE"="DEPTS"."DEPTCODE")
Note
-----
- dynamic sampling used for this statement (level=2)
Statistics
----------------------------------------------------------
14 recursive calls
0 db block gets
102391 consistent gets
26099 physical reads
0 redo size
20041 bytes sent via SQL*Net to client
2835 bytes received via SQL*Net from client
21 SQL*Net roundtrips to/from client
0 sorts (memory)
0 sorts (disk)
287 rows processed
SQL> SELECT /*+ index(GS IND_DGSN_GOODSCODE) */ GS.*
2 FROM "xxx".tbdgs GS,
3 (SELECT COALESCE (JT.GoodsCode, FL.GoodsCode) GoodsCode
4 FROM (SELECT E.GoodsCode,
5 G.BILLNUMBER,
6 G.MAINGOODSID,
7 G.INSIDEID,
8 G.DEPTTYPE,
9 G.CATEGORYITEMCODE,
10 G.DEPTCODE,
11 G.PRICEMODE,
12 G.PURCHPRICE,
13 G.WITHHOLDINGRATES,
14 G.MAXPURCHPRICE,
15 G.RATE,
16 G.SUPPLYGOODSTIME,
17 G.COUNTERCODE,
18 G.PRICECOMPENSATYPE,
19 G.YPRICEMODE,
20 G.YPURCHPRICE,
21 G.YWITHHOLDINGRATES,
22 G.YHIGHPURCHPRICE,
23 G.SGSUPPLIERRATE,
24 G.VIPSUPPLIERRATE,
25 G.TEMPBEGINDATE,
26 G.TEMPENDDATE,
27 G.TEMPRATE
28 FROM (SELECT m.BillNumber
29 FROM "xxx".TB201308_ConGoodsBill M, tmp1060 t
30 WHERE t.BillNumber = m.BillNumber
31 AND M.ExecuteDate = '20130924') M,
32 (SELECT G.BILLNUMBER,
33 G.MAINGOODSID,
34 G.INSIDEID,
35 G.DEPTTYPE,
36 G.CATEGORYITEMCODE,
37 G.DEPTCODE,
38 G.PRICEMODE,
39 G.PURCHPRICE,
40 G.WITHHOLDINGRATES,
41 G.MAXPURCHPRICE,
42 G.RATE,
43 G.SUPPLYGOODSTIME,
44 G.COUNTERCODE,
45 G.PRICECOMPENSATYPE,
46 G.YPRICEMODE,
47 G.YPURCHPRICE,
48 G.YWITHHOLDINGRATES,
49 G.YHIGHPURCHPRICE,
50 G.SGSUPPLIERRATE,
51 G.VIPSUPPLIERRATE,
52 G.TempBeginDate,
53 G.TempEndDate,
54 G.TempRate
55 FROM "xxx".TB201308_DeptConGoods G
56 WHERE G.DeptType = 1 AND G.DeptCode = '1329') G,
57 "xxx".TB201308_ConGoodsDetail E
58 WHERE M.BillNumber = G.BillNumber
59 AND M.BillNumber = E.BillNumber
60 AND G.MainGoodsID = E.InsideID) JT
61 FULL JOIN
62 (SELECT /*+ index(G IDX_09$DEPTCODE) index(E PK_TB201309_CONGOODSDETAIL) */
63 E.GoodsCode,
64 G.BILLNUMBER,
65 G.MAINGOODSID,
66 G.INSIDEID,
67 G.DEPTTYPE,
68 G.CATEGORYITEMCODE,
69 G.DEPTCODE,
70 G.PRICEMODE,
71 G.PURCHPRICE,
72 G.WITHHOLDINGRATES,
73 G.MAXPURCHPRICE,
74 G.RATE,
75 G.SUPPLYGOODSTIME,
76 G.COUNTERCODE,
77 G.PRICECOMPENSATYPE,
78 G.YPRICEMODE,
79 G.YPURCHPRICE,
80 G.YWITHHOLDINGRATES,
81 G.YHIGHPURCHPRICE,
82 G.SGSUPPLIERRATE,
83 G.VIPSUPPLIERRATE,
84 G.TEMPBEGINDATE,
85 G.TEMPENDDATE,
86 G.TEMPRATE
87 FROM (SELECT m.BillNumber
88 FROM "xxx".TB201308_ConGoodsBill M, tmp1060 T
89 WHERE m.BillNumber = t.BillNumber
90 AND M.ExecuteDate = '20130924') M,
91 "xxx".TB201308_DeptConGoods G,
92 "xxx".tbCatToDepartment D,
93 "xxx".TB201308_ConGoodsDetail E
94 WHERE M.BillNumber = G.BillNumber
95 AND M.BillNumber = E.BillNumber
96 AND G.DeptType = 0
97 AND D.NodeCode = '1329'
98 AND G.CategoryItemCode = D.DeptCatItemCode
99 AND G.DeptCode = D.DeptCategoryCode
100 AND G.MainGoodsID = E.InsideID) FL
101 ON JT.BillNumber = FL.BillNumber
102 AND JT.DeptCode = FL.DeptCode
103 AND JT.GoodsCode = FL.GoodsCode
104 UNION ALL
105 SELECT COALESCE (JT.GoodsCode, FL.GoodsCode) GoodsCode
106 FROM (SELECT E.GoodsCode,
107 G.BILLNUMBER,
108 G.MAINGOODSID,
109 G.INSIDEID,
110 G.DEPTTYPE,
111 G.CATEGORYITEMCODE,
112 G.DEPTCODE,
113 G.PRICEMODE,
114 G.PURCHPRICE,
115 G.WITHHOLDINGRATES,
116 G.MAXPURCHPRICE,
117 G.RATE,
118 G.SUPPLYGOODSTIME,
119 G.COUNTERCODE,
120 G.PRICECOMPENSATYPE,
121 G.YPRICEMODE,
122 G.YPURCHPRICE,
123 G.YWITHHOLDINGRATES,
124 G.YHIGHPURCHPRICE,
125 G.SGSUPPLIERRATE,
126 G.VIPSUPPLIERRATE,
127 G.TEMPBEGINDATE,
128 G.TEMPENDDATE,
129 G.TEMPRATE
130 FROM (SELECT m.BillNumber
131 FROM "xxx".TB201309_ConGoodsBill M, tmp1060 t
132 WHERE t.BillNumber = m.BillNumber
133 AND M.ExecuteDate = '20130924') M,
134 (SELECT G.BILLNUMBER,
135 G.MAINGOODSID,
136 G.INSIDEID,
137 G.DEPTTYPE,
138 G.CATEGORYITEMCODE,
139 G.DEPTCODE,
140 G.PRICEMODE,
141 G.PURCHPRICE,
142 G.WITHHOLDINGRATES,
143 G.MAXPURCHPRICE,
144 G.RATE,
145 G.SUPPLYGOODSTIME,
146 G.COUNTERCODE,
147 G.PRICECOMPENSATYPE,
148 G.YPRICEMODE,
149 G.YPURCHPRICE,
150 G.YWITHHOLDINGRATES,
151 G.YHIGHPURCHPRICE,
152 G.SGSUPPLIERRATE,
153 G.VIPSUPPLIERRATE,
154 G.TempBeginDate,
155 G.TempEndDate,
156 G.TempRate
157 FROM "xxx".TB201309_DeptConGoods G
158 WHERE G.DeptType = 1 AND G.DeptCode = '1329') G,
159 "xxx".TB201309_ConGoodsDetail E
160 WHERE M.BillNumber = G.BillNumber
161 AND M.BillNumber = E.BillNumber
162 AND G.MainGoodsID = E.InsideID) JT
163 FULL JOIN
164 (SELECT /*+ index(G IDX_09$DEPTCODE) index(E PK_TB201309_CONGOODSDETAIL) */
165 E.GoodsCode,
166 G.BILLNUMBER,
167 G.MAINGOODSID,
168 G.INSIDEID,
169 G.DEPTTYPE,
170 G.CATEGORYITEMCODE,
171 G.DEPTCODE,
172 G.PRICEMODE,
173 G.PURCHPRICE,
174 G.WITHHOLDINGRATES,
175 G.MAXPURCHPRICE,
176 G.RATE,
177 G.SUPPLYGOODSTIME,
178 G.COUNTERCODE,
179 G.PRICECOMPENSATYPE,
180 G.YPRICEMODE,
181 G.YPURCHPRICE,
182 G.YWITHHOLDINGRATES,
183 G.YHIGHPURCHPRICE,
184 G.SGSUPPLIERRATE,
185 G.VIPSUPPLIERRATE,
186 G.TEMPBEGINDATE,
187 G.TEMPENDDATE,
188 G.TEMPRATE
189 FROM (SELECT m.BillNumber
190 FROM "xxx".TB201309_ConGoodsBill M, tmp1060 T
191 WHERE m.BillNumber = t.BillNumber
192 AND M.ExecuteDate = '20130924') M,
193 "xxx".TB201309_DeptConGoods G,
194 "xxx".tbCatToDepartment D,
195 "xxx".TB201309_ConGoodsDetail E
196 WHERE M.BillNumber = G.BillNumber
197 AND M.BillNumber = E.BillNumber
198 AND G.DeptType = 0
199 AND D.NodeCode = '1329'
200 AND G.CategoryItemCode = D.DeptCatItemCode
201 AND G.DeptCode = D.DeptCategoryCode
202 AND G.MainGoodsID = E.InsideID) FL
203 ON JT.BillNumber = FL.BillNumber
204 AND JT.DeptCode = FL.DeptCode
205 AND JT.GoodsCode = FL.GoodsCode) GCON
206 WHERE EXISTS
207 (SELECT /*+ hash_sj(GS depts) */ 1
208 FROM (SELECT 0 DeptType, DeptCategoryCode DeptCode
209 FROM "xxx".tbCatToDepartment
210 WHERE NodeCode = '1329' AND DeptCatItemCode = '0004'
211 UNION ALL
212 SELECT 1 DeptType, '1329' DeptCode FROM DUAL) depts
213 WHERE GS.DeptCode = depts.DeptCode
214 AND GS.DeptType = depts.DeptType)
215 AND GS.GoodsCode = GCON.GoodsCode;
287 rows selected.
Elapsed: 00:00:13.04
Execution Plan
----------------------------------------------------------
Plan hash value: 1100727240
------------------------------------------------------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
------------------------------------------------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 59 | 4838 | 208K (1)| 00:41:42 |
|* 1 | HASH JOIN RIGHT SEMI | | 59 | 4838 | 208K (1)| 00:41:42 |
| 2 | VIEW | | 2 | 22 | 18 (0)| 00:00:01 |
| 3 | UNION-ALL | | | | | |
|* 4 | TABLE ACCESS BY INDEX ROWID | TBCATTODEPARTMENT | 1 | 15 | 16 (0)| 00:00:01 |
|* 5 | INDEX RANGE SCAN | IDX$$_3F470002 | 16 | | 1 (0)| 00:00:01 |
| 6 | FAST DUAL | | 1 | | 2 (0)| 00:00:01 |
| 7 | NESTED LOOPS | | | | | |
| 8 | NESTED LOOPS | | 210K| 14M| 208K (1)| 00:41:42 |
| 9 | VIEW | | 1256 | 11304 | 55113 (1)| 00:11:02 |
| 10 | UNION-ALL | | | | | |
| 11 | VIEW | VW_FOJ_0 | 4 | 72 | 204 (1)| 00:00:03 |
|* 12 | HASH JOIN FULL OUTER | | 4 | 232 | 204 (1)| 00:00:03 |
| 13 | VIEW | | 1 | 29 | 82 (2)| 00:00:01 |
|* 14 | HASH JOIN | | 1 | 128 | 82 (2)| 00:00:01 |
| 15 | NESTED LOOPS | | | | | |
| 16 | NESTED LOOPS | | 1 | 116 | 63 (0)| 00:00:01 |
| 17 | NESTED LOOPS | | 3 | 246 | 57 (0)| 00:00:01 |
| 18 | NESTED LOOPS | | 716 | 47972 | 57 (0)| 00:00:01 |
| 19 | TABLE ACCESS BY INDEX ROWID | TB201308_CONGOODSBILL | 23 | 667 | 4 (0)| 00:00:01 |
|* 20 | INDEX RANGE SCAN | IDX_201308EXECUTEDATE | 23 | | 3 (0)| 00:00:01 |
|* 21 | TABLE ACCESS BY INDEX ROWID | TB201308_DEPTCONGOODS | 31 | 1178 | 5 (0)| 00:00:01 |
|* 22 | INDEX RANGE SCAN | IDX201308DEPTCONGOODS | 57 | | 2 (0)| 00:00:01 |
|* 23 | INDEX UNIQUE SCAN | PK_TBCATTODEPARTMENT | 1 | 15 | 0 (0)| 00:00:01 |
|* 24 | INDEX UNIQUE SCAN | PK_TB201308_CONGOODSDETAIL | 1 | | 1 (0)| 00:00:01 |
| 25 | TABLE ACCESS BY INDEX ROWID | TB201308_CONGOODSDETAIL | 1 | 34 | 2 (0)| 00:00:01 |
| 26 | TABLE ACCESS FULL | tmp1060 | 16956 | 198K| 18 (0)| 00:00:01 |
| 27 | VIEW | | 4 | 116 | 122 (1)| 00:00:02 |
|* 28 | HASH JOIN | | 4 | 436 | 122 (1)| 00:00:02 |
| 29 | NESTED LOOPS | | | | | |
| 30 | NESTED LOOPS | | 4 | 388 | 103 (0)| 00:00:02 |
| 31 | NESTED LOOPS | | 23 | 1449 | 57 (0)| 00:00:01 |
| 32 | TABLE ACCESS BY INDEX ROWID | TB201308_CONGOODSBILL | 23 | 667 | 4 (0)| 00:00:01 |
|* 33 | INDEX RANGE SCAN | IDX_201308EXECUTEDATE | 23 | | 3 (0)| 00:00:01 |
|* 34 | TABLE ACCESS BY INDEX ROWID | TB201308_DEPTCONGOODS | 1 | 34 | 5 (0)| 00:00:01 |
|* 35 | INDEX RANGE SCAN | IDX201308DEPTCONGOODS | 57 | | 2 (0)| 00:00:01 |
|* 36 | INDEX UNIQUE SCAN | PK_TB201308_CONGOODSDETAIL | 1 | | 1 (0)| 00:00:01 |
| 37 | TABLE ACCESS BY INDEX ROWID | TB201308_CONGOODSDETAIL | 1 | 34 | 2 (0)| 00:00:01 |
| 38 | TABLE ACCESS FULL | tmp1060 | 16956 | 198K| 18 (0)| 00:00:01 |
| 39 | VIEW | VW_FOJ_1 | 1252 | 22536 | 54909 (1)| 00:10:59 |
|* 40 | HASH JOIN FULL OUTER | | 1252 | 72616 | 54909 (1)| 00:10:59 |
| 41 | VIEW | | 104 | 3016 | 3387 (1)| 00:00:41 |
| 42 | NESTED LOOPS | | | | | |
| 43 | NESTED LOOPS | | 104 | 11336 | 3387 (1)| 00:00:41 |
|* 44 | HASH JOIN | | 788 | 59100 | 1810 (1)| 00:00:22 |
|* 45 | TABLE ACCESS BY INDEX ROWID | TB201309_DEPTCONGOODS | 807 | 27438 | 1328 (1)| 00:00:16 |
|* 46 | INDEX RANGE SCAN | IDX_09$DEPTCODE | 1652 | | 8 (0)| 00:00:01 |
|* 47 | HASH JOIN | | 16956 | 678K| 481 (1)| 00:00:06 |
| 48 | TABLE ACCESS FULL | tmp1060 | 16956 | 198K| 18 (0)| 00:00:01 |
| 49 | TABLE ACCESS BY INDEX ROWID | TB201309_CONGOODSBILL | 17356 | 491K| 462 (1)| 00:00:06 |
|* 50 | INDEX RANGE SCAN | IDX_201309EXECUTEDATE | 17356 | | 71 (0)| 00:00:01 |
|* 51 | INDEX UNIQUE SCAN | PK_TB201309_CONGOODSDETAIL | 1 | | 1 (0)| 00:00:01 |
| 52 | TABLE ACCESS BY INDEX ROWID | TB201309_CONGOODSDETAIL | 1 | 34 | 2 (0)| 00:00:01 |
| 53 | VIEW | | 1252 | 36308 | 51522 (1)| 00:10:19 |
|* 54 | HASH JOIN | | 1252 | 156K| 51522 (1)| 00:10:19 |
| 55 | NESTED LOOPS | | | | | |
| 56 | NESTED LOOPS | | 1252 | 141K| 51503 (1)| 00:10:19 |
|* 57 | HASH JOIN | | 9473 | 758K| 32546 (1)| 00:06:31 |
| 58 | NESTED LOOPS | | | | | |
| 59 | NESTED LOOPS | | 9473 | 490K| 32083 (1)| 00:06:25 |
| 60 | TABLE ACCESS BY INDEX ROWID| TBCATTODEPARTMENT | 16 | 240 | 16 (0)| 00:00:01 |
|* 61 | INDEX RANGE SCAN | IDX$$_3F470002 | 16 | | 1 (0)| 00:00:01 |
|* 62 | INDEX RANGE SCAN | IDX_09$DEPTCODE | 2496 | | 10 (0)| 00:00:01 |
|* 63 | TABLE ACCESS BY INDEX ROWID | TB201309_DEPTCONGOODS | 593 | 22534 | 2004 (1)| 00:00:25 |
| 64 | TABLE ACCESS BY INDEX ROWID | TB201309_CONGOODSBILL | 17356 | 491K| 462 (1)| 00:00:06 |
|* 65 | INDEX RANGE SCAN | IDX_201309EXECUTEDATE | 17356 | | 71 (0)| 00:00:01 |
|* 66 | INDEX UNIQUE SCAN | PK_TB201309_CONGOODSDETAIL | 1 | | 1 (0)| 00:00:01 |
| 67 | TABLE ACCESS BY INDEX ROWID | TB201309_CONGOODSDETAIL | 1 | 34 | 2 (0)| 00:00:01 |
| 68 | TABLE ACCESS FULL | tmp1060 | 16956 | 198K| 18 (0)| 00:00:01 |
|* 69 | INDEX RANGE SCAN | IND_DGSN_GOODSCODE | 168 | | 3 (0)| 00:00:01 |
| 70 | TABLE ACCESS BY INDEX ROWID | tbdgs | 168 | 10416 | 122 (0)| 00:00:02 |
------------------------------------------------------------------------------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
1 - access("GS"."DEPTCODE"="DEPTS"."DEPTCODE" AND "GS"."DEPTTYPE"="DEPTS"."DEPTTYPE")
4 - filter("DEPTCATITEMCODE"='0004')
5 - access("NODECODE"='1329')
12 - access("JT"."BILLNUMBER"="FL"."BILLNUMBER" AND "JT"."DEPTCODE"="FL"."DEPTCODE" AND
"JT"."GOODSCODE"="FL"."GOODSCODE")
14 - access("M"."BILLNUMBER"="T"."BILLNUMBER")
20 - access("M"."EXECUTEDATE"='20130924')
21 - filter("G"."DEPTTYPE"=0)
22 - access("M"."BILLNUMBER"="G"."BILLNUMBER")
23 - access("G"."DEPTCODE"="D"."DEPTCATEGORYCODE" AND "G"."CATEGORYITEMCODE"="D"."DEPTCATITEMCODE" AND
"D"."NODECODE"='1329')
24 - access("M"."BILLNUMBER"="E"."BILLNUMBER" AND "G"."MAINGOODSID"="E"."INSIDEID")
28 - access("T"."BILLNUMBER"="M"."BILLNUMBER")
33 - access("M"."EXECUTEDATE"='20130924')
34 - filter("G"."DEPTCODE"='1329' AND "G"."DEPTTYPE"=1)
35 - access("M"."BILLNUMBER"="G"."BILLNUMBER")
36 - access("M"."BILLNUMBER"="E"."BILLNUMBER" AND "G"."MAINGOODSID"="E"."INSIDEID")
40 - access("JT"."BILLNUMBER"="FL"."BILLNUMBER" AND "JT"."DEPTCODE"="FL"."DEPTCODE" AND
"JT"."GOODSCODE"="FL"."GOODSCODE")
44 - access("M"."BILLNUMBER"="G"."BILLNUMBER")
45 - filter("G"."DEPTTYPE"=1)
46 - access("G"."DEPTCODE"='1329')
47 - access("T"."BILLNUMBER"="M"."BILLNUMBER")
50 - access("M"."EXECUTEDATE"='20130924')
51 - access("M"."BILLNUMBER"="E"."BILLNUMBER" AND "G"."MAINGOODSID"="E"."INSIDEID")
54 - access("M"."BILLNUMBER"="T"."BILLNUMBER")
57 - access("M"."BILLNUMBER"="G"."BILLNUMBER")
61 - access("D"."NODECODE"='1329')
62 - access("G"."DEPTCODE"="D"."DEPTCATEGORYCODE")
63 - filter("G"."DEPTTYPE"=0 AND "G"."CATEGORYITEMCODE"="D"."DEPTCATITEMCODE")
65 - access("M"."EXECUTEDATE"='20130924')
66 - access("M"."BILLNUMBER"="E"."BILLNUMBER" AND "G"."MAINGOODSID"="E"."INSIDEID")
69 - access("GS"."GOODSCODE"="GCON"."GOODSCODE")
Note
-----
- dynamic sampling used for this statement (level=2)
Statistics
----------------------------------------------------------
13 recursive calls
0 db block gets
37249 consistent gets
3926 physical reads
0 redo size
19895 bytes sent via SQL*Net to client
2874 bytes received via SQL*Net from client
21 SQL*Net roundtrips to/from client
0 sorts (memory)
0 sorts (disk)
287 rows processed
SQL> SELECT /*+ index(GS IND_DGSN_GOODSCODE) */ GS.*
2 FROM "xxx".tbdgs GS,
3 (SELECT COALESCE (JT.GoodsCode, FL.GoodsCode) GoodsCode
4 FROM (SELECT E.GoodsCode,
5 G.BILLNUMBER,
6 G.MAINGOODSID,
7 G.INSIDEID,
8 G.DEPTTYPE,
9 G.CATEGORYITEMCODE,
10 G.DEPTCODE,
11 G.PRICEMODE,
12 G.PURCHPRICE,
13 G.WITHHOLDINGRATES,
14 G.MAXPURCHPRICE,
15 G.RATE,
16 G.SUPPLYGOODSTIME,
17 G.COUNTERCODE,
18 G.PRICECOMPENSATYPE,
19 G.YPRICEMODE,
20 G.YPURCHPRICE,
21 G.YWITHHOLDINGRATES,
22 G.YHIGHPURCHPRICE,
23 G.SGSUPPLIERRATE,
24 G.VIPSUPPLIERRATE,
25 G.TEMPBEGINDATE,
26 G.TEMPENDDATE,
27 G.TEMPRATE
28 FROM (SELECT m.BillNumber
29 FROM "xxx".TB201308_ConGoodsBill M, tmp1060 t
30 WHERE t.BillNumber = m.BillNumber
31 AND M.ExecuteDate = '20130924') M,
32 (SELECT G.BILLNUMBER,
33 G.MAINGOODSID,
34 G.INSIDEID,
35 G.DEPTTYPE,
36 G.CATEGORYITEMCODE,
37 G.DEPTCODE,
38 G.PRICEMODE,
39 G.PURCHPRICE,
40 G.WITHHOLDINGRATES,
41 G.MAXPURCHPRICE,
42 G.RATE,
43 G.SUPPLYGOODSTIME,
44 G.COUNTERCODE,
45 G.PRICECOMPENSATYPE,
46 G.YPRICEMODE,
47 G.YPURCHPRICE,
48 G.YWITHHOLDINGRATES,
49 G.YHIGHPURCHPRICE,
50 G.SGSUPPLIERRATE,
51 G.VIPSUPPLIERRATE,
52 G.TempBeginDate,
53 G.TempEndDate,
54 G.TempRate
55 FROM "xxx".TB201308_DeptConGoods G
56 WHERE G.DeptType = 1 AND G.DeptCode = '1329') G,
57 "xxx".TB201308_ConGoodsDetail E
58 WHERE M.BillNumber = G.BillNumber
59 AND M.BillNumber = E.BillNumber
60 AND G.MainGoodsID = E.InsideID) JT
61 FULL JOIN
62 (SELECT /*+ index(G IDX_09$DEPTCODE) index(E PK_TB201309_CONGOODSDETAIL) */
63 E.GoodsCode,
64 G.BILLNUMBER,
65 G.MAINGOODSID,
66 G.INSIDEID,
67 G.DEPTTYPE,
68 G.CATEGORYITEMCODE,
69 G.DEPTCODE,
70 G.PRICEMODE,
71 G.PURCHPRICE,
72 G.WITHHOLDINGRATES,
73 G.MAXPURCHPRICE,
74 G.RATE,
75 G.SUPPLYGOODSTIME,
76 G.COUNTERCODE,
77 G.PRICECOMPENSATYPE,
78 G.YPRICEMODE,
79 G.YPURCHPRICE,
80 G.YWITHHOLDINGRATES,
81 G.YHIGHPURCHPRICE,
82 G.SGSUPPLIERRATE,
83 G.VIPSUPPLIERRATE,
84 G.TEMPBEGINDATE,
85 G.TEMPENDDATE,
86 G.TEMPRATE
87 FROM (SELECT m.BillNumber
88 FROM "xxx".TB201308_ConGoodsBill M, tmp1060 T
89 WHERE m.BillNumber = t.BillNumber
90 AND M.ExecuteDate = '20130924') M,
91 "xxx".TB201308_DeptConGoods G,
92 "xxx".tbCatToDepartment D,
93 "xxx".TB201308_ConGoodsDetail E
94 WHERE M.BillNumber = G.BillNumber
95 AND M.BillNumber = E.BillNumber
96 AND G.DeptType = 0
97 AND D.NodeCode = '1329'
98 AND G.CategoryItemCode = D.DeptCatItemCode
99 AND G.DeptCode = D.DeptCategoryCode
100 AND G.MainGoodsID = E.InsideID) FL
101 ON JT.BillNumber = FL.BillNumber
102 AND JT.DeptCode = FL.DeptCode
103 AND JT.GoodsCode = FL.GoodsCode
104 UNION ALL
105 SELECT COALESCE (JT.GoodsCode, FL.GoodsCode) GoodsCode
106 FROM (SELECT E.GoodsCode,
107 G.BILLNUMBER,
108 G.MAINGOODSID,
109 G.INSIDEID,
110 G.DEPTTYPE,
111 G.CATEGORYITEMCODE,
112 G.DEPTCODE,
113 G.PRICEMODE,
114 G.PURCHPRICE,
115 G.WITHHOLDINGRATES,
116 G.MAXPURCHPRICE,
117 G.RATE,
118 G.SUPPLYGOODSTIME,
119 G.COUNTERCODE,
120 G.PRICECOMPENSATYPE,
121 G.YPRICEMODE,
122 G.YPURCHPRICE,
123 G.YWITHHOLDINGRATES,
124 G.YHIGHPURCHPRICE,
125 G.SGSUPPLIERRATE,
126 G.VIPSUPPLIERRATE,
127 G.TEMPBEGINDATE,
128 G.TEMPENDDATE,
129 G.TEMPRATE
130 FROM (SELECT m.BillNumber
131 FROM "xxx".TB201309_ConGoodsBill M, tmp1060 t
132 WHERE t.BillNumber = m.BillNumber
133 AND M.ExecuteDate = '20130924') M,
134 (SELECT G.BILLNUMBER,
135 G.MAINGOODSID,
136 G.INSIDEID,
137 G.DEPTTYPE,
138 G.CATEGORYITEMCODE,
139 G.DEPTCODE,
140 G.PRICEMODE,
141 G.PURCHPRICE,
142 G.WITHHOLDINGRATES,
143 G.MAXPURCHPRICE,
144 G.RATE,
145 G.SUPPLYGOODSTIME,
146 G.COUNTERCODE,
147 G.PRICECOMPENSATYPE,
148 G.YPRICEMODE,
149 G.YPURCHPRICE,
150 G.YWITHHOLDINGRATES,
151 G.YHIGHPURCHPRICE,
152 G.SGSUPPLIERRATE,
153 G.VIPSUPPLIERRATE,
154 G.TempBeginDate,
155 G.TempEndDate,
156 G.TempRate
157 FROM "xxx".TB201309_DeptConGoods G
158 WHERE G.DeptType = 1 AND G.DeptCode = '1329') G,
159 "xxx".TB201309_ConGoodsDetail E
160 WHERE M.BillNumber = G.BillNumber
161 AND M.BillNumber = E.BillNumber
162 AND G.MainGoodsID = E.InsideID) JT
163 FULL JOIN
164 (SELECT /*+ index(G IDX_09$DEPTCODE) index(E PK_TB201309_CONGOODSDETAIL) */
165 E.GoodsCode,
166 G.BILLNUMBER,
167 G.MAINGOODSID,
168 G.INSIDEID,
169 G.DEPTTYPE,
170 G.CATEGORYITEMCODE,
171 G.DEPTCODE,
172 G.PRICEMODE,
173 G.PURCHPRICE,
174 G.WITHHOLDINGRATES,
175 G.MAXPURCHPRICE,
176 G.RATE,
177 G.SUPPLYGOODSTIME,
178 G.COUNTERCODE,
179 G.PRICECOMPENSATYPE,
180 G.YPRICEMODE,
181 G.YPURCHPRICE,
182 G.YWITHHOLDINGRATES,
183 G.YHIGHPURCHPRICE,
184 G.SGSUPPLIERRATE,
185 G.VIPSUPPLIERRATE,
186 G.TEMPBEGINDATE,
187 G.TEMPENDDATE,
188 G.TEMPRATE
189 FROM (SELECT m.BillNumber
190 FROM "xxx".TB201309_ConGoodsBill M, tmp1060 T
191 WHERE m.BillNumber = t.BillNumber
192 AND M.ExecuteDate = '20130924') M,
193 "xxx".TB201309_DeptConGoods G,
194 "xxx".tbCatToDepartment D,
195 "xxx".TB201309_ConGoodsDetail E
196 WHERE M.BillNumber = G.BillNumber
197 AND M.BillNumber = E.BillNumber
198 AND G.DeptType = 0
199 AND D.NodeCode = '1329'
200 AND G.CategoryItemCode = D.DeptCatItemCode
201 AND G.DeptCode = D.DeptCategoryCode
202 AND G.MainGoodsID = E.InsideID) FL
203 ON JT.BillNumber = FL.BillNumber
204 AND JT.DeptCode = FL.DeptCode
205 AND JT.GoodsCode = FL.GoodsCode) GCON
206 WHERE EXISTS
207 (SELECT /*+ hash_sj(GS depts) */ 1
208 FROM (SELECT 0 DeptType, DeptCategoryCode DeptCode
209 FROM "xxx".tbCatToDepartment
210 WHERE NodeCode = '1329' AND DeptCatItemCode = '0004'
211 UNION ALL
212 SELECT 1 DeptType, '1329' DeptCode FROM DUAL) depts
213 WHERE GS.DeptCode = depts.DeptCode
214 AND GS.DeptType = depts.DeptType)
215 AND GS.GoodsCode = GCON.GoodsCode;
287 rows selected.
Elapsed: 00:00:07.64
Execution Plan
----------------------------------------------------------
Plan hash value: 1100727240
------------------------------------------------------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
------------------------------------------------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 59 | 4838 | 208K (1)| 00:41:42 |
|* 1 | HASH JOIN RIGHT SEMI | | 59 | 4838 | 208K (1)| 00:41:42 |
| 2 | VIEW | | 2 | 22 | 18 (0)| 00:00:01 |
| 3 | UNION-ALL | | | | | |
|* 4 | TABLE ACCESS BY INDEX ROWID | TBCATTODEPARTMENT | 1 | 15 | 16 (0)| 00:00:01 |
|* 5 | INDEX RANGE SCAN | IDX$$_3F470002 | 16 | | 1 (0)| 00:00:01 |
| 6 | FAST DUAL | | 1 | | 2 (0)| 00:00:01 |
| 7 | NESTED LOOPS | | | | | |
| 8 | NESTED LOOPS | | 210K| 14M| 208K (1)| 00:41:42 |
| 9 | VIEW | | 1256 | 11304 | 55113 (1)| 00:11:02 |
| 10 | UNION-ALL | | | | | |
| 11 | VIEW | VW_FOJ_0 | 4 | 72 | 204 (1)| 00:00:03 |
|* 12 | HASH JOIN FULL OUTER | | 4 | 232 | 204 (1)| 00:00:03 |
| 13 | VIEW | | 1 | 29 | 82 (2)| 00:00:01 |
|* 14 | HASH JOIN | | 1 | 128 | 82 (2)| 00:00:01 |
| 15 | NESTED LOOPS | | | | | |
| 16 | NESTED LOOPS | | 1 | 116 | 63 (0)| 00:00:01 |
| 17 | NESTED LOOPS | | 3 | 246 | 57 (0)| 00:00:01 |
| 18 | NESTED LOOPS | | 716 | 47972 | 57 (0)| 00:00:01 |
| 19 | TABLE ACCESS BY INDEX ROWID | TB201308_CONGOODSBILL | 23 | 667 | 4 (0)| 00:00:01 |
|* 20 | INDEX RANGE SCAN | IDX_201308EXECUTEDATE | 23 | | 3 (0)| 00:00:01 |
|* 21 | TABLE ACCESS BY INDEX ROWID | TB201308_DEPTCONGOODS | 31 | 1178 | 5 (0)| 00:00:01 |
|* 22 | INDEX RANGE SCAN | IDX201308DEPTCONGOODS | 57 | | 2 (0)| 00:00:01 |
|* 23 | INDEX UNIQUE SCAN | PK_TBCATTODEPARTMENT | 1 | 15 | 0 (0)| 00:00:01 |
|* 24 | INDEX UNIQUE SCAN | PK_TB201308_CONGOODSDETAIL | 1 | | 1 (0)| 00:00:01 |
| 25 | TABLE ACCESS BY INDEX ROWID | TB201308_CONGOODSDETAIL | 1 | 34 | 2 (0)| 00:00:01 |
| 26 | TABLE ACCESS FULL | tmp1060 | 16956 | 198K| 18 (0)| 00:00:01 |
| 27 | VIEW | | 4 | 116 | 122 (1)| 00:00:02 |
|* 28 | HASH JOIN | | 4 | 436 | 122 (1)| 00:00:02 |
| 29 | NESTED LOOPS | | | | | |
| 30 | NESTED LOOPS | | 4 | 388 | 103 (0)| 00:00:02 |
| 31 | NESTED LOOPS | | 23 | 1449 | 57 (0)| 00:00:01 |
| 32 | TABLE ACCESS BY INDEX ROWID | TB201308_CONGOODSBILL | 23 | 667 | 4 (0)| 00:00:01 |
|* 33 | INDEX RANGE SCAN | IDX_201308EXECUTEDATE | 23 | | 3 (0)| 00:00:01 |
|* 34 | TABLE ACCESS BY INDEX ROWID | TB201308_DEPTCONGOODS | 1 | 34 | 5 (0)| 00:00:01 |
|* 35 | INDEX RANGE SCAN | IDX201308DEPTCONGOODS | 57 | | 2 (0)| 00:00:01 |
|* 36 | INDEX UNIQUE SCAN | PK_TB201308_CONGOODSDETAIL | 1 | | 1 (0)| 00:00:01 |
| 37 | TABLE ACCESS BY INDEX ROWID | TB201308_CONGOODSDETAIL | 1 | 34 | 2 (0)| 00:00:01 |
| 38 | TABLE ACCESS FULL | tmp1060 | 16956 | 198K| 18 (0)| 00:00:01 |
| 39 | VIEW | VW_FOJ_1 | 1252 | 22536 | 54909 (1)| 00:10:59 |
|* 40 | HASH JOIN FULL OUTER | | 1252 | 72616 | 54909 (1)| 00:10:59 |
| 41 | VIEW | | 104 | 3016 | 3387 (1)| 00:00:41 |
| 42 | NESTED LOOPS | | | | | |
| 43 | NESTED LOOPS | | 104 | 11336 | 3387 (1)| 00:00:41 |
|* 44 | HASH JOIN | | 788 | 59100 | 1810 (1)| 00:00:22 |
|* 45 | TABLE ACCESS BY INDEX ROWID | TB201309_DEPTCONGOODS | 807 | 27438 | 1328 (1)| 00:00:16 |
|* 46 | INDEX RANGE SCAN | IDX_09$DEPTCODE | 1652 | | 8 (0)| 00:00:01 |
|* 47 | HASH JOIN | | 16956 | 678K| 481 (1)| 00:00:06 |
| 48 | TABLE ACCESS FULL | tmp1060 | 16956 | 198K| 18 (0)| 00:00:01 |
| 49 | TABLE ACCESS BY INDEX ROWID | TB201309_CONGOODSBILL | 17356 | 491K| 462 (1)| 00:00:06 |
|* 50 | INDEX RANGE SCAN | IDX_201309EXECUTEDATE | 17356 | | 71 (0)| 00:00:01 |
|* 51 | INDEX UNIQUE SCAN | PK_TB201309_CONGOODSDETAIL | 1 | | 1 (0)| 00:00:01 |
| 52 | TABLE ACCESS BY INDEX ROWID | TB201309_CONGOODSDETAIL | 1 | 34 | 2 (0)| 00:00:01 |
| 53 | VIEW | | 1252 | 36308 | 51522 (1)| 00:10:19 |
|* 54 | HASH JOIN | | 1252 | 156K| 51522 (1)| 00:10:19 |
| 55 | NESTED LOOPS | | | | | |
| 56 | NESTED LOOPS | | 1252 | 141K| 51503 (1)| 00:10:19 |
|* 57 | HASH JOIN | | 9473 | 758K| 32546 (1)| 00:06:31 |
| 58 | NESTED LOOPS | | | | | |
| 59 | NESTED LOOPS | | 9473 | 490K| 32083 (1)| 00:06:25 |
| 60 | TABLE ACCESS BY INDEX ROWID| TBCATTODEPARTMENT | 16 | 240 | 16 (0)| 00:00:01 |
|* 61 | INDEX RANGE SCAN | IDX$$_3F470002 | 16 | | 1 (0)| 00:00:01 |
|* 62 | INDEX RANGE SCAN | IDX_09$DEPTCODE | 2496 | | 10 (0)| 00:00:01 |
|* 63 | TABLE ACCESS BY INDEX ROWID | TB201309_DEPTCONGOODS | 593 | 22534 | 2004 (1)| 00:00:25 |
| 64 | TABLE ACCESS BY INDEX ROWID | TB201309_CONGOODSBILL | 17356 | 491K| 462 (1)| 00:00:06 |
|* 65 | INDEX RANGE SCAN | IDX_201309EXECUTEDATE | 17356 | | 71 (0)| 00:00:01 |
|* 66 | INDEX UNIQUE SCAN | PK_TB201309_CONGOODSDETAIL | 1 | | 1 (0)| 00:00:01 |
| 67 | TABLE ACCESS BY INDEX ROWID | TB201309_CONGOODSDETAIL | 1 | 34 | 2 (0)| 00:00:01 |
| 68 | TABLE ACCESS FULL | tmp1060 | 16956 | 198K| 18 (0)| 00:00:01 |
|* 69 | INDEX RANGE SCAN | IND_DGSN_GOODSCODE | 168 | | 3 (0)| 00:00:01 |
| 70 | TABLE ACCESS BY INDEX ROWID | tbdgs | 168 | 10416 | 122 (0)| 00:00:02 |
------------------------------------------------------------------------------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
1 - access("GS"."DEPTCODE"="DEPTS"."DEPTCODE" AND "GS"."DEPTTYPE"="DEPTS"."DEPTTYPE")
4 - filter("DEPTCATITEMCODE"='0004')
5 - access("NODECODE"='1329')
12 - access("JT"."BILLNUMBER"="FL"."BILLNUMBER" AND "JT"."DEPTCODE"="FL"."DEPTCODE" AND
"JT"."GOODSCODE"="FL"."GOODSCODE")
14 - access("M"."BILLNUMBER"="T"."BILLNUMBER")
20 - access("M"."EXECUTEDATE"='20130924')
21 - filter("G"."DEPTTYPE"=0)
22 - access("M"."BILLNUMBER"="G"."BILLNUMBER")
23 - access("G"."DEPTCODE"="D"."DEPTCATEGORYCODE" AND "G"."CATEGORYITEMCODE"="D"."DEPTCATITEMCODE" AND
"D"."NODECODE"='1329')
24 - access("M"."BILLNUMBER"="E"."BILLNUMBER" AND "G"."MAINGOODSID"="E"."INSIDEID")
28 - access("T"."BILLNUMBER"="M"."BILLNUMBER")
33 - access("M"."EXECUTEDATE"='20130924')
34 - filter("G"."DEPTCODE"='1329' AND "G"."DEPTTYPE"=1)
35 - access("M"."BILLNUMBER"="G"."BILLNUMBER")
36 - access("M"."BILLNUMBER"="E"."BILLNUMBER" AND "G"."MAINGOODSID"="E"."INSIDEID")
40 - access("JT"."BILLNUMBER"="FL"."BILLNUMBER" AND "JT"."DEPTCODE"="FL"."DEPTCODE" AND
"JT"."GOODSCODE"="FL"."GOODSCODE")
44 - access("M"."BILLNUMBER"="G"."BILLNUMBER")
45 - filter("G"."DEPTTYPE"=1)
46 - access("G"."DEPTCODE"='1329')
47 - access("T"."BILLNUMBER"="M"."BILLNUMBER")
50 - access("M"."EXECUTEDATE"='20130924')
51 - access("M"."BILLNUMBER"="E"."BILLNUMBER" AND "G"."MAINGOODSID"="E"."INSIDEID")
54 - access("M"."BILLNUMBER"="T"."BILLNUMBER")
57 - access("M"."BILLNUMBER"="G"."BILLNUMBER")
61 - access("D"."NODECODE"='1329')
62 - access("G"."DEPTCODE"="D"."DEPTCATEGORYCODE")
63 - filter("G"."DEPTTYPE"=0 AND "G"."CATEGORYITEMCODE"="D"."DEPTCATITEMCODE")
65 - access("M"."EXECUTEDATE"='20130924')
66 - access("M"."BILLNUMBER"="E"."BILLNUMBER" AND "G"."MAINGOODSID"="E"."INSIDEID")
69 - access("GS"."GOODSCODE"="GCON"."GOODSCODE")
Note
-----
- dynamic sampling used for this statement (level=2)
Statistics
----------------------------------------------------------
13 recursive calls
0 db block gets
37489 consistent gets
1233 physical reads
0 redo size
19337 bytes sent via SQL*Net to client
2874 bytes received via SQL*Net from client
21 SQL*Net roundtrips to/from client
0 sorts (memory)
0 sorts (disk)
287 rows processed
SQL>
SQL> SELECT /*+ index(GS IND_DGSN_GOODSCODE) dynamic_sampling(GS 0) */ GS.*
2 FROM "xxx".tbdgs GS,
3 (SELECT COALESCE (JT.GoodsCode, FL.GoodsCode) GoodsCode
4 FROM (SELECT E.GoodsCode,
5 G.BILLNUMBER,
6 G.MAINGOODSID,
7 G.INSIDEID,
8 G.DEPTTYPE,
9 G.CATEGORYITEMCODE,
10 G.DEPTCODE,
11 G.PRICEMODE,
12 G.PURCHPRICE,
13 G.WITHHOLDINGRATES,
14 G.MAXPURCHPRICE,
15 G.RATE,
16 G.SUPPLYGOODSTIME,
17 G.COUNTERCODE,
18 G.PRICECOMPENSATYPE,
19 G.YPRICEMODE,
20 G.YPURCHPRICE,
21 G.YWITHHOLDINGRATES,
22 G.YHIGHPURCHPRICE,
23 G.SGSUPPLIERRATE,
24 G.VIPSUPPLIERRATE,
25 G.TEMPBEGINDATE,
26 G.TEMPENDDATE,
27 G.TEMPRATE
28 FROM (SELECT m.BillNumber
29 FROM "xxx".TB201308_ConGoodsBill M, tmp1060 t
30 WHERE t.BillNumber = m.BillNumber
31 AND M.ExecuteDate = '20130924') M,
32 (SELECT G.BILLNUMBER,
33 G.MAINGOODSID,
34 G.INSIDEID,
35 G.DEPTTYPE,
36 G.CATEGORYITEMCODE,
37 G.DEPTCODE,
38 G.PRICEMODE,
39 G.PURCHPRICE,
40 G.WITHHOLDINGRATES,
41 G.MAXPURCHPRICE,
42 G.RATE,
43 G.SUPPLYGOODSTIME,
44 G.COUNTERCODE,
45 G.PRICECOMPENSATYPE,
46 G.YPRICEMODE,
47 G.YPURCHPRICE,
48 G.YWITHHOLDINGRATES,
49 G.YHIGHPURCHPRICE,
50 G.SGSUPPLIERRATE,
51 G.VIPSUPPLIERRATE,
52 G.TempBeginDate,
53 G.TempEndDate,
54 G.TempRate
55 FROM "xxx".TB201308_DeptConGoods G
56 WHERE G.DeptType = 1 AND G.DeptCode = '1329') G,
57 "xxx".TB201308_ConGoodsDetail E
58 WHERE M.BillNumber = G.BillNumber
59 AND M.BillNumber = E.BillNumber
60 AND G.MainGoodsID = E.InsideID) JT
61 FULL JOIN
62 (SELECT /*+ index(G IDX_09$DEPTCODE) index(E PK_TB201309_CONGOODSDETAIL) */
63 E.GoodsCode,
64 G.BILLNUMBER,
65 G.MAINGOODSID,
66 G.INSIDEID,
67 G.DEPTTYPE,
68 G.CATEGORYITEMCODE,
69 G.DEPTCODE,
70 G.PRICEMODE,
71 G.PURCHPRICE,
72 G.WITHHOLDINGRATES,
73 G.MAXPURCHPRICE,
74 G.RATE,
75 G.SUPPLYGOODSTIME,
76 G.COUNTERCODE,
77 G.PRICECOMPENSATYPE,
78 G.YPRICEMODE,
79 G.YPURCHPRICE,
80 G.YWITHHOLDINGRATES,
81 G.YHIGHPURCHPRICE,
82 G.SGSUPPLIERRATE,
83 G.VIPSUPPLIERRATE,
84 G.TEMPBEGINDATE,
85 G.TEMPENDDATE,
86 G.TEMPRATE
87 FROM (SELECT m.BillNumber
88 FROM "xxx".TB201308_ConGoodsBill M, tmp1060 T
89 WHERE m.BillNumber = t.BillNumber
90 AND M.ExecuteDate = '20130924') M,
91 "xxx".TB201308_DeptConGoods G,
92 "xxx".tbCatToDepartment D,
93 "xxx".TB201308_ConGoodsDetail E
94 WHERE M.BillNumber = G.BillNumber
95 AND M.BillNumber = E.BillNumber
96 AND G.DeptType = 0
97 AND D.NodeCode = '1329'
98 AND G.CategoryItemCode = D.DeptCatItemCode
99 AND G.DeptCode = D.DeptCategoryCode
100 AND G.MainGoodsID = E.InsideID) FL
101 ON JT.BillNumber = FL.BillNumber
102 AND JT.DeptCode = FL.DeptCode
103 AND JT.GoodsCode = FL.GoodsCode
104 UNION ALL
105 SELECT COALESCE (JT.GoodsCode, FL.GoodsCode) GoodsCode
106 FROM (SELECT E.GoodsCode,
107 G.BILLNUMBER,
108 G.MAINGOODSID,
109 G.INSIDEID,
110 G.DEPTTYPE,
111 G.CATEGORYITEMCODE,
112 G.DEPTCODE,
113 G.PRICEMODE,
114 G.PURCHPRICE,
115 G.WITHHOLDINGRATES,
116 G.MAXPURCHPRICE,
117 G.RATE,
118 G.SUPPLYGOODSTIME,
119 G.COUNTERCODE,
120 G.PRICECOMPENSATYPE,
121 G.YPRICEMODE,
122 G.YPURCHPRICE,
123 G.YWITHHOLDINGRATES,
124 G.YHIGHPURCHPRICE,
125 G.SGSUPPLIERRATE,
126 G.VIPSUPPLIERRATE,
127 G.TEMPBEGINDATE,
128 G.TEMPENDDATE,
129 G.TEMPRATE
130 FROM (SELECT m.BillNumber
131 FROM "xxx".TB201309_ConGoodsBill M, tmp1060 t
132 WHERE t.BillNumber = m.BillNumber
133 AND M.ExecuteDate = '20130924') M,
134 (SELECT G.BILLNUMBER,
135 G.MAINGOODSID,
136 G.INSIDEID,
137 G.DEPTTYPE,
138 G.CATEGORYITEMCODE,
139 G.DEPTCODE,
140 G.PRICEMODE,
141 G.PURCHPRICE,
142 G.WITHHOLDINGRATES,
143 G.MAXPURCHPRICE,
144 G.RATE,
145 G.SUPPLYGOODSTIME,
146 G.COUNTERCODE,
147 G.PRICECOMPENSATYPE,
148 G.YPRICEMODE,
149 G.YPURCHPRICE,
150 G.YWITHHOLDINGRATES,
151 G.YHIGHPURCHPRICE,
152 G.SGSUPPLIERRATE,
153 G.VIPSUPPLIERRATE,
154 G.TempBeginDate,
155 G.TempEndDate,
156 G.TempRate
157 FROM "xxx".TB201309_DeptConGoods G
158 WHERE G.DeptType = 1 AND G.DeptCode = '1329') G,
159 "xxx".TB201309_ConGoodsDetail E
160 WHERE M.BillNumber = G.BillNumber
161 AND M.BillNumber = E.BillNumber
162 AND G.MainGoodsID = E.InsideID) JT
163 FULL JOIN
164 (SELECT /*+ index(G IDX_09$DEPTCODE) index(E PK_TB201309_CONGOODSDETAIL) */
165 E.GoodsCode,
166 G.BILLNUMBER,
167 G.MAINGOODSID,
168 G.INSIDEID,
169 G.DEPTTYPE,
170 G.CATEGORYITEMCODE,
171 G.DEPTCODE,
172 G.PRICEMODE,
173 G.PURCHPRICE,
174 G.WITHHOLDINGRATES,
175 G.MAXPURCHPRICE,
176 G.RATE,
177 G.SUPPLYGOODSTIME,
178 G.COUNTERCODE,
179 G.PRICECOMPENSATYPE,
180 G.YPRICEMODE,
181 G.YPURCHPRICE,
182 G.YWITHHOLDINGRATES,
183 G.YHIGHPURCHPRICE,
184 G.SGSUPPLIERRATE,
185 G.VIPSUPPLIERRATE,
186 G.TEMPBEGINDATE,
187 G.TEMPENDDATE,
188 G.TEMPRATE
189 FROM (SELECT m.BillNumber
190 FROM "xxx".TB201309_ConGoodsBill M, tmp1060 T
191 WHERE m.BillNumber = t.BillNumber
192 AND M.ExecuteDate = '20130924') M,
193 "xxx".TB201309_DeptConGoods G,
194 "xxx".tbCatToDepartment D,
195 "xxx".TB201309_ConGoodsDetail E
196 WHERE M.BillNumber = G.BillNumber
197 AND M.BillNumber = E.BillNumber
198 AND G.DeptType = 0
199 AND D.NodeCode = '1329'
200 AND G.CategoryItemCode = D.DeptCatItemCode
201 AND G.DeptCode = D.DeptCategoryCode
202 AND G.MainGoodsID = E.InsideID) FL
203 ON JT.BillNumber = FL.BillNumber
204 AND JT.DeptCode = FL.DeptCode
205 AND JT.GoodsCode = FL.GoodsCode) GCON
206 WHERE EXISTS
207 (SELECT /*+ hash_sj(GS depts) */ 1
208 FROM (SELECT 0 DeptType, DeptCategoryCode DeptCode
209 FROM "xxx".tbCatToDepartment
210 WHERE NodeCode = '1329' AND DeptCatItemCode = '0004'
211 UNION ALL
212 SELECT 1 DeptType, '1329' DeptCode FROM DUAL) depts
213 WHERE GS.DeptCode = depts.DeptCode
214 AND GS.DeptType = depts.DeptType)
215 AND GS.GoodsCode = GCON.GoodsCode;
287 rows selected.
Elapsed: 00:00:00.32
Execution Plan
----------------------------------------------------------
Plan hash value: 1100727240
------------------------------------------------------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
------------------------------------------------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 59 | 4838 | 208K (1)| 00:41:42 |
|* 1 | HASH JOIN RIGHT SEMI | | 59 | 4838 | 208K (1)| 00:41:42 |
| 2 | VIEW | | 2 | 22 | 18 (0)| 00:00:01 |
| 3 | UNION-ALL | | | | | |
|* 4 | TABLE ACCESS BY INDEX ROWID | TBCATTODEPARTMENT | 1 | 15 | 16 (0)| 00:00:01 |
|* 5 | INDEX RANGE SCAN | IDX$$_3F470002 | 16 | | 1 (0)| 00:00:01 |
| 6 | FAST DUAL | | 1 | | 2 (0)| 00:00:01 |
| 7 | NESTED LOOPS | | | | | |
| 8 | NESTED LOOPS | | 210K| 14M| 208K (1)| 00:41:42 |
| 9 | VIEW | | 1256 | 11304 | 55113 (1)| 00:11:02 |
| 10 | UNION-ALL | | | | | |
| 11 | VIEW | VW_FOJ_0 | 4 | 72 | 204 (1)| 00:00:03 |
|* 12 | HASH JOIN FULL OUTER | | 4 | 232 | 204 (1)| 00:00:03 |
| 13 | VIEW | | 1 | 29 | 82 (2)| 00:00:01 |
|* 14 | HASH JOIN | | 1 | 128 | 82 (2)| 00:00:01 |
| 15 | NESTED LOOPS | | | | | |
| 16 | NESTED LOOPS | | 1 | 116 | 63 (0)| 00:00:01 |
| 17 | NESTED LOOPS | | 3 | 246 | 57 (0)| 00:00:01 |
| 18 | NESTED LOOPS | | 716 | 47972 | 57 (0)| 00:00:01 |
| 19 | TABLE ACCESS BY INDEX ROWID | TB201308_CONGOODSBILL | 23 | 667 | 4 (0)| 00:00:01 |
|* 20 | INDEX RANGE SCAN | IDX_201308EXECUTEDATE | 23 | | 3 (0)| 00:00:01 |
|* 21 | TABLE ACCESS BY INDEX ROWID | TB201308_DEPTCONGOODS | 31 | 1178 | 5 (0)| 00:00:01 |
|* 22 | INDEX RANGE SCAN | IDX201308DEPTCONGOODS | 57 | | 2 (0)| 00:00:01 |
|* 23 | INDEX UNIQUE SCAN | PK_TBCATTODEPARTMENT | 1 | 15 | 0 (0)| 00:00:01 |
|* 24 | INDEX UNIQUE SCAN | PK_TB201308_CONGOODSDETAIL | 1 | | 1 (0)| 00:00:01 |
| 25 | TABLE ACCESS BY INDEX ROWID | TB201308_CONGOODSDETAIL | 1 | 34 | 2 (0)| 00:00:01 |
| 26 | TABLE ACCESS FULL | tmp1060 | 16956 | 198K| 18 (0)| 00:00:01 |
| 27 | VIEW | | 4 | 116 | 122 (1)| 00:00:02 |
|* 28 | HASH JOIN | | 4 | 436 | 122 (1)| 00:00:02 |
| 29 | NESTED LOOPS | | | | | |
| 30 | NESTED LOOPS | | 4 | 388 | 103 (0)| 00:00:02 |
| 31 | NESTED LOOPS | | 23 | 1449 | 57 (0)| 00:00:01 |
| 32 | TABLE ACCESS BY INDEX ROWID | TB201308_CONGOODSBILL | 23 | 667 | 4 (0)| 00:00:01 |
|* 33 | INDEX RANGE SCAN | IDX_201308EXECUTEDATE | 23 | | 3 (0)| 00:00:01 |
|* 34 | TABLE ACCESS BY INDEX ROWID | TB201308_DEPTCONGOODS | 1 | 34 | 5 (0)| 00:00:01 |
|* 35 | INDEX RANGE SCAN | IDX201308DEPTCONGOODS | 57 | | 2 (0)| 00:00:01 |
|* 36 | INDEX UNIQUE SCAN | PK_TB201308_CONGOODSDETAIL | 1 | | 1 (0)| 00:00:01 |
| 37 | TABLE ACCESS BY INDEX ROWID | TB201308_CONGOODSDETAIL | 1 | 34 | 2 (0)| 00:00:01 |
| 38 | TABLE ACCESS FULL | tmp1060 | 16956 | 198K| 18 (0)| 00:00:01 |
| 39 | VIEW | VW_FOJ_1 | 1252 | 22536 | 54909 (1)| 00:10:59 |
|* 40 | HASH JOIN FULL OUTER | | 1252 | 72616 | 54909 (1)| 00:10:59 |
| 41 | VIEW | | 104 | 3016 | 3387 (1)| 00:00:41 |
| 42 | NESTED LOOPS | | | | | |
| 43 | NESTED LOOPS | | 104 | 11336 | 3387 (1)| 00:00:41 |
|* 44 | HASH JOIN | | 788 | 59100 | 1810 (1)| 00:00:22 |
|* 45 | TABLE ACCESS BY INDEX ROWID | TB201309_DEPTCONGOODS | 807 | 27438 | 1328 (1)| 00:00:16 |
|* 46 | INDEX RANGE SCAN | IDX_09$DEPTCODE | 1652 | | 8 (0)| 00:00:01 |
|* 47 | HASH JOIN | | 16956 | 678K| 481 (1)| 00:00:06 |
| 48 | TABLE ACCESS FULL | tmp1060 | 16956 | 198K| 18 (0)| 00:00:01 |
| 49 | TABLE ACCESS BY INDEX ROWID | TB201309_CONGOODSBILL | 17356 | 491K| 462 (1)| 00:00:06 |
|* 50 | INDEX RANGE SCAN | IDX_201309EXECUTEDATE | 17356 | | 71 (0)| 00:00:01 |
|* 51 | INDEX UNIQUE SCAN | PK_TB201309_CONGOODSDETAIL | 1 | | 1 (0)| 00:00:01 |
| 52 | TABLE ACCESS BY INDEX ROWID | TB201309_CONGOODSDETAIL | 1 | 34 | 2 (0)| 00:00:01 |
| 53 | VIEW | | 1252 | 36308 | 51522 (1)| 00:10:19 |
|* 54 | HASH JOIN | | 1252 | 156K| 51522 (1)| 00:10:19 |
| 55 | NESTED LOOPS | | | | | |
| 56 | NESTED LOOPS | | 1252 | 141K| 51503 (1)| 00:10:19 |
|* 57 | HASH JOIN | | 9473 | 758K| 32546 (1)| 00:06:31 |
| 58 | NESTED LOOPS | | | | | |
| 59 | NESTED LOOPS | | 9473 | 490K| 32083 (1)| 00:06:25 |
| 60 | TABLE ACCESS BY INDEX ROWID| TBCATTODEPARTMENT | 16 | 240 | 16 (0)| 00:00:01 |
|* 61 | INDEX RANGE SCAN | IDX$$_3F470002 | 16 | | 1 (0)| 00:00:01 |
|* 62 | INDEX RANGE SCAN | IDX_09$DEPTCODE | 2496 | | 10 (0)| 00:00:01 |
|* 63 | TABLE ACCESS BY INDEX ROWID | TB201309_DEPTCONGOODS | 593 | 22534 | 2004 (1)| 00:00:25 |
| 64 | TABLE ACCESS BY INDEX ROWID | TB201309_CONGOODSBILL | 17356 | 491K| 462 (1)| 00:00:06 |
|* 65 | INDEX RANGE SCAN | IDX_201309EXECUTEDATE | 17356 | | 71 (0)| 00:00:01 |
|* 66 | INDEX UNIQUE SCAN | PK_TB201309_CONGOODSDETAIL | 1 | | 1 (0)| 00:00:01 |
| 67 | TABLE ACCESS BY INDEX ROWID | TB201309_CONGOODSDETAIL | 1 | 34 | 2 (0)| 00:00:01 |
| 68 | TABLE ACCESS FULL | tmp1060 | 16956 | 198K| 18 (0)| 00:00:01 |
|* 69 | INDEX RANGE SCAN | IND_DGSN_GOODSCODE | 168 | | 3 (0)| 00:00:01 |
| 70 | TABLE ACCESS BY INDEX ROWID | tbdgs | 168 | 10416 | 122 (0)| 00:00:02 |
------------------------------------------------------------------------------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
1 - access("GS"."DEPTCODE"="DEPTS"."DEPTCODE" AND "GS"."DEPTTYPE"="DEPTS"."DEPTTYPE")
4 - filter("DEPTCATITEMCODE"='0004')
5 - access("NODECODE"='1329')
12 - access("JT"."BILLNUMBER"="FL"."BILLNUMBER" AND "JT"."DEPTCODE"="FL"."DEPTCODE" AND
"JT"."GOODSCODE"="FL"."GOODSCODE")
14 - access("M"."BILLNUMBER"="T"."BILLNUMBER")
20 - access("M"."EXECUTEDATE"='20130924')
21 - filter("G"."DEPTTYPE"=0)
22 - access("M"."BILLNUMBER"="G"."BILLNUMBER")
23 - access("G"."DEPTCODE"="D"."DEPTCATEGORYCODE" AND "G"."CATEGORYITEMCODE"="D"."DEPTCATITEMCODE" AND
"D"."NODECODE"='1329')
24 - access("M"."BILLNUMBER"="E"."BILLNUMBER" AND "G"."MAINGOODSID"="E"."INSIDEID")
28 - access("T"."BILLNUMBER"="M"."BILLNUMBER")
33 - access("M"."EXECUTEDATE"='20130924')
34 - filter("G"."DEPTCODE"='1329' AND "G"."DEPTTYPE"=1)
35 - access("M"."BILLNUMBER"="G"."BILLNUMBER")
36 - access("M"."BILLNUMBER"="E"."BILLNUMBER" AND "G"."MAINGOODSID"="E"."INSIDEID")
40 - access("JT"."BILLNUMBER"="FL"."BILLNUMBER" AND "JT"."DEPTCODE"="FL"."DEPTCODE" AND
"JT"."GOODSCODE"="FL"."GOODSCODE")
44 - access("M"."BILLNUMBER"="G"."BILLNUMBER")
45 - filter("G"."DEPTTYPE"=1)
46 - access("G"."DEPTCODE"='1329')
47 - access("T"."BILLNUMBER"="M"."BILLNUMBER")
50 - access("M"."EXECUTEDATE"='20130924')
51 - access("M"."BILLNUMBER"="E"."BILLNUMBER" AND "G"."MAINGOODSID"="E"."INSIDEID")
54 - access("M"."BILLNUMBER"="T"."BILLNUMBER")
57 - access("M"."BILLNUMBER"="G"."BILLNUMBER")
61 - access("D"."NODECODE"='1329')
62 - access("G"."DEPTCODE"="D"."DEPTCATEGORYCODE")
63 - filter("G"."DEPTTYPE"=0 AND "G"."CATEGORYITEMCODE"="D"."DEPTCATITEMCODE")
65 - access("M"."EXECUTEDATE"='20130924')
66 - access("M"."BILLNUMBER"="E"."BILLNUMBER" AND "G"."MAINGOODSID"="E"."INSIDEID")
69 - access("GS"."GOODSCODE"="GCON"."GOODSCODE")
Note
-----
- dynamic sampling used for this statement (level=2)
Statistics
----------------------------------------------------------
14 recursive calls
0 db block gets
37527 consistent gets
0 physical reads
0 redo size
19337 bytes sent via SQL*Net to client
2897 bytes received via SQL*Net from client
21 SQL*Net roundtrips to/from client
0 sorts (memory)
0 sorts (disk)
287 rows processed
SQL> SELECT /*+ index(GS IND_DGSN_GOODSCODE) dynamic_sampling(0) */ GS.*
2 FROM "xxx".tbdgs GS,
3 (SELECT COALESCE (JT.GoodsCode, FL.GoodsCode) GoodsCode
4 FROM (SELECT E.GoodsCode,
5 G.BILLNUMBER,
6 G.MAINGOODSID,
7 G.INSIDEID,
8 G.DEPTTYPE,
9 G.CATEGORYITEMCODE,
10 G.DEPTCODE,
11 G.PRICEMODE,
12 G.PURCHPRICE,
13 G.WITHHOLDINGRATES,
14 G.MAXPURCHPRICE,
15 G.RATE,
16 G.SUPPLYGOODSTIME,
17 G.COUNTERCODE,
18 G.PRICECOMPENSATYPE,
19 G.YPRICEMODE,
20 G.YPURCHPRICE,
21 G.YWITHHOLDINGRATES,
22 G.YHIGHPURCHPRICE,
23 G.SGSUPPLIERRATE,
24 G.VIPSUPPLIERRATE,
25 G.TEMPBEGINDATE,
26 G.TEMPENDDATE,
27 G.TEMPRATE
28 FROM (SELECT m.BillNumber
29 FROM "xxx".TB201308_ConGoodsBill M, tmp1060 t
30 WHERE t.BillNumber = m.BillNumber
31 AND M.ExecuteDate = '20130924') M,
32 (SELECT G.BILLNUMBER,
33 G.MAINGOODSID,
34 G.INSIDEID,
35 G.DEPTTYPE,
36 G.CATEGORYITEMCODE,
37 G.DEPTCODE,
38 G.PRICEMODE,
39 G.PURCHPRICE,
40 G.WITHHOLDINGRATES,
41 G.MAXPURCHPRICE,
42 G.RATE,
43 G.SUPPLYGOODSTIME,
44 G.COUNTERCODE,
45 G.PRICECOMPENSATYPE,
46 G.YPRICEMODE,
47 G.YPURCHPRICE,
48 G.YWITHHOLDINGRATES,
49 G.YHIGHPURCHPRICE,
50 G.SGSUPPLIERRATE,
51 G.VIPSUPPLIERRATE,
52 G.TempBeginDate,
53 G.TempEndDate,
54 G.TempRate
55 FROM "xxx".TB201308_DeptConGoods G
56 WHERE G.DeptType = 1 AND G.DeptCode = '1329') G,
57 "xxx".TB201308_ConGoodsDetail E
58 WHERE M.BillNumber = G.BillNumber
59 AND M.BillNumber = E.BillNumber
60 AND G.MainGoodsID = E.InsideID) JT
61 FULL JOIN
62 (SELECT /*+ index(G IDX_09$DEPTCODE) index(E PK_TB201309_CONGOODSDETAIL) */
63 E.GoodsCode,
64 G.BILLNUMBER,
65 G.MAINGOODSID,
66 G.INSIDEID,
67 G.DEPTTYPE,
68 G.CATEGORYITEMCODE,
69 G.DEPTCODE,
70 G.PRICEMODE,
71 G.PURCHPRICE,
72 G.WITHHOLDINGRATES,
73 G.MAXPURCHPRICE,
74 G.RATE,
75 G.SUPPLYGOODSTIME,
76 G.COUNTERCODE,
77 G.PRICECOMPENSATYPE,
78 G.YPRICEMODE,
79 G.YPURCHPRICE,
80 G.YWITHHOLDINGRATES,
81 G.YHIGHPURCHPRICE,
82 G.SGSUPPLIERRATE,
83 G.VIPSUPPLIERRATE,
84 G.TEMPBEGINDATE,
85 G.TEMPENDDATE,
86 G.TEMPRATE
87 FROM (SELECT m.BillNumber
88 FROM "xxx".TB201308_ConGoodsBill M, tmp1060 T
89 WHERE m.BillNumber = t.BillNumber
90 AND M.ExecuteDate = '20130924') M,
91 "xxx".TB201308_DeptConGoods G,
92 "xxx".tbCatToDepartment D,
93 "xxx".TB201308_ConGoodsDetail E
94 WHERE M.BillNumber = G.BillNumber
95 AND M.BillNumber = E.BillNumber
96 AND G.DeptType = 0
97 AND D.NodeCode = '1329'
98 AND G.CategoryItemCode = D.DeptCatItemCode
99 AND G.DeptCode = D.DeptCategoryCode
100 AND G.MainGoodsID = E.InsideID) FL
101 ON JT.BillNumber = FL.BillNumber
102 AND JT.DeptCode = FL.DeptCode
103 AND JT.GoodsCode = FL.GoodsCode
104 UNION ALL
105 SELECT COALESCE (JT.GoodsCode, FL.GoodsCode) GoodsCode
106 FROM (SELECT E.GoodsCode,
107 G.BILLNUMBER,
108 G.MAINGOODSID,
109 G.INSIDEID,
110 G.DEPTTYPE,
111 G.CATEGORYITEMCODE,
112 G.DEPTCODE,
113 G.PRICEMODE,
114 G.PURCHPRICE,
115 G.WITHHOLDINGRATES,
116 G.MAXPURCHPRICE,
117 G.RATE,
118 G.SUPPLYGOODSTIME,
119 G.COUNTERCODE,
120 G.PRICECOMPENSATYPE,
121 G.YPRICEMODE,
122 G.YPURCHPRICE,
123 G.YWITHHOLDINGRATES,
124 G.YHIGHPURCHPRICE,
125 G.SGSUPPLIERRATE,
126 G.VIPSUPPLIERRATE,
127 G.TEMPBEGINDATE,
128 G.TEMPENDDATE,
129 G.TEMPRATE
130 FROM (SELECT m.BillNumber
131 FROM "xxx".TB201309_ConGoodsBill M, tmp1060 t
132 WHERE t.BillNumber = m.BillNumber
133 AND M.ExecuteDate = '20130924') M,
134 (SELECT G.BILLNUMBER,
135 G.MAINGOODSID,
136 G.INSIDEID,
137 G.DEPTTYPE,
138 G.CATEGORYITEMCODE,
139 G.DEPTCODE,
140 G.PRICEMODE,
141 G.PURCHPRICE,
142 G.WITHHOLDINGRATES,
143 G.MAXPURCHPRICE,
144 G.RATE,
145 G.SUPPLYGOODSTIME,
146 G.COUNTERCODE,
147 G.PRICECOMPENSATYPE,
148 G.YPRICEMODE,
149 G.YPURCHPRICE,
150 G.YWITHHOLDINGRATES,
151 G.YHIGHPURCHPRICE,
152 G.SGSUPPLIERRATE,
153 G.VIPSUPPLIERRATE,
154 G.TempBeginDate,
155 G.TempEndDate,
156 G.TempRate
157 FROM "xxx".TB201309_DeptConGoods G
158 WHERE G.DeptType = 1 AND G.DeptCode = '1329') G,
159 "xxx".TB201309_ConGoodsDetail E
160 WHERE M.BillNumber = G.BillNumber
161 AND M.BillNumber = E.BillNumber
162 AND G.MainGoodsID = E.InsideID) JT
163 FULL JOIN
164 (SELECT /*+ index(G IDX_09$DEPTCODE) index(E PK_TB201309_CONGOODSDETAIL) */
165 E.GoodsCode,
166 G.BILLNUMBER,
167 G.MAINGOODSID,
168 G.INSIDEID,
169 G.DEPTTYPE,
170 G.CATEGORYITEMCODE,
171 G.DEPTCODE,
172 G.PRICEMODE,
173 G.PURCHPRICE,
174 G.WITHHOLDINGRATES,
175 G.MAXPURCHPRICE,
176 G.RATE,
177 G.SUPPLYGOODSTIME,
178 G.COUNTERCODE,
179 G.PRICECOMPENSATYPE,
180 G.YPRICEMODE,
181 G.YPURCHPRICE,
182 G.YWITHHOLDINGRATES,
183 G.YHIGHPURCHPRICE,
184 G.SGSUPPLIERRATE,
185 G.VIPSUPPLIERRATE,
186 G.TEMPBEGINDATE,
187 G.TEMPENDDATE,
188 G.TEMPRATE
189 FROM (SELECT m.BillNumber
190 FROM "xxx".TB201309_ConGoodsBill M, tmp1060 T
191 WHERE m.BillNumber = t.BillNumber
192 AND M.ExecuteDate = '20130924') M,
193 "xxx".TB201309_DeptConGoods G,
194 "xxx".tbCatToDepartment D,
195 "xxx".TB201309_ConGoodsDetail E
196 WHERE M.BillNumber = G.BillNumber
197 AND M.BillNumber = E.BillNumber
198 AND G.DeptType = 0
199 AND D.NodeCode = '1329'
200 AND G.CategoryItemCode = D.DeptCatItemCode
201 AND G.DeptCode = D.DeptCategoryCode
202 AND G.MainGoodsID = E.InsideID) FL
203 ON JT.BillNumber = FL.BillNumber
204 AND JT.DeptCode = FL.DeptCode
205 AND JT.GoodsCode = FL.GoodsCode) GCON
206 WHERE EXISTS
207 (SELECT /*+ hash_sj(GS depts) */ 1
208 FROM (SELECT 0 DeptType, DeptCategoryCode DeptCode
209 FROM "xxx".tbCatToDepartment
210 WHERE NodeCode = '1329' AND DeptCatItemCode = '0004'
211 UNION ALL
212 SELECT 1 DeptType, '1329' DeptCode FROM DUAL) depts
213 WHERE GS.DeptCode = depts.DeptCode
214 AND GS.DeptType = depts.DeptType)
215 AND GS.GoodsCode = GCON.GoodsCode;
287 rows selected.
Elapsed: 00:00:00.24
Execution Plan
----------------------------------------------------------
Plan hash value: 4145260636
------------------------------------------------------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
------------------------------------------------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 2 | 164 | 41819 (1)| 00:08:22 |
|* 1 | HASH JOIN RIGHT SEMI | | 2 | 164 | 41819 (1)| 00:08:22 |
| 2 | VIEW | | 2 | 22 | 18 (0)| 00:00:01 |
| 3 | UNION-ALL | | | | | |
|* 4 | TABLE ACCESS BY INDEX ROWID | TBCATTODEPARTMENT | 1 | 15 | 16 (0)| 00:00:01 |
|* 5 | INDEX RANGE SCAN | IDX$$_3F470002 | 16 | | 1 (0)| 00:00:01 |
| 6 | FAST DUAL | | 1 | | 2 (0)| 00:00:01 |
| 7 | NESTED LOOPS | | | | | |
| 8 | NESTED LOOPS | | 8901 | 617K| 41800 (1)| 00:08:22 |
| 9 | VIEW | | 53 | 477 | 35331 (1)| 00:07:04 |
| 10 | UNION-ALL | | | | | |
| 11 | VIEW | VW_FOJ_0 | 1 | 18 | 82 (3)| 00:00:01 |
|* 12 | HASH JOIN FULL OUTER | | 1 | 58 | 82 (3)| 00:00:01 |
| 13 | VIEW | | 1 | 29 | 41 (3)| 00:00:01 |
| 14 | NESTED LOOPS | | | | | |
| 15 | NESTED LOOPS | | 1 | 109 | 41 (3)| 00:00:01 |
| 16 | NESTED LOOPS | | 1 | 75 | 39 (3)| 00:00:01 |
|* 17 | HASH JOIN | | 1 | 41 | 34 (3)| 00:00:01 |
| 18 | TABLE ACCESS BY INDEX ROWID | TB201308_CONGOODSBILL | 23 | 667 | 4 (0)| 00:00:01 |
|* 19 | INDEX RANGE SCAN | IDX_201308EXECUTEDATE | 23 | | 3 (0)| 00:00:01 |
| 20 | TABLE ACCESS FULL | tmp1060 | 8168 | 98016 | 29 (0)| 00:00:01 |
|* 21 | TABLE ACCESS BY INDEX ROWID | TB201308_DEPTCONGOODS | 1 | 34 | 5 (0)| 00:00:01 |
|* 22 | INDEX RANGE SCAN | IDX201308DEPTCONGOODS | 57 | | 2 (0)| 00:00:01 |
|* 23 | INDEX UNIQUE SCAN | PK_TB201308_CONGOODSDETAIL | 1 | | 1 (0)| 00:00:01 |
| 24 | TABLE ACCESS BY INDEX ROWID | TB201308_CONGOODSDETAIL | 1 | 34 | 2 (0)| 00:00:01 |
| 25 | VIEW | | 1 | 29 | 41 (3)| 00:00:01 |
| 26 | NESTED LOOPS | | | | | |
| 27 | NESTED LOOPS | | 1 | 128 | 41 (3)| 00:00:01 |
| 28 | NESTED LOOPS | | 1 | 94 | 39 (3)| 00:00:01 |
| 29 | NESTED LOOPS | | 24 | 1896 | 39 (3)| 00:00:01 |
|* 30 | HASH JOIN | | 1 | 41 | 34 (3)| 00:00:01 |
| 31 | TABLE ACCESS BY INDEX ROWID | TB201308_CONGOODSBILL | 23 | 667 | 4 (0)| 00:00:01 |
|* 32 | INDEX RANGE SCAN | IDX_201308EXECUTEDATE | 23 | | 3 (0)| 00:00:01 |
| 33 | TABLE ACCESS FULL | tmp1060 | 8168 | 98016 | 29 (0)| 00:00:01 |
|* 34 | TABLE ACCESS BY INDEX ROWID | TB201308_DEPTCONGOODS | 31 | 1178 | 5 (0)| 00:00:01 |
|* 35 | INDEX RANGE SCAN | IDX201308DEPTCONGOODS | 57 | | 2 (0)| 00:00:01 |
|* 36 | INDEX UNIQUE SCAN | PK_TBCATTODEPARTMENT | 1 | 15 | 0 (0)| 00:00:01 |
|* 37 | INDEX UNIQUE SCAN | PK_TB201308_CONGOODSDETAIL | 1 | | 1 (0)| 00:00:01 |
| 38 | TABLE ACCESS BY INDEX ROWID | TB201308_CONGOODSDETAIL | 1 | 34 | 2 (0)| 00:00:01 |
| 39 | VIEW | VW_FOJ_1 | 52 | 936 | 35249 (1)| 00:07:03 |
|* 40 | HASH JOIN FULL OUTER | | 52 | 3016 | 35249 (1)| 00:07:03 |
| 41 | VIEW | | 4 | 116 | 1886 (1)| 00:00:23 |
| 42 | NESTED LOOPS | | | | | |
| 43 | NESTED LOOPS | | 4 | 436 | 1886 (1)| 00:00:23 |
|* 44 | HASH JOIN | | 33 | 2475 | 1820 (1)| 00:00:22 |
|* 45 | HASH JOIN | | 807 | 50841 | 1791 (1)| 00:00:22 |
|* 46 | TABLE ACCESS BY INDEX ROWID | TB201309_DEPTCONGOODS | 807 | 27438 | 1328 (1)| 00:00:16 |
|* 47 | INDEX RANGE SCAN | IDX_09$DEPTCODE | 1652 | | 8 (0)| 00:00:01 |
| 48 | TABLE ACCESS BY INDEX ROWID | TB201309_CONGOODSBILL | 17356 | 491K| 462 (1)| 00:00:06 |
|* 49 | INDEX RANGE SCAN | IDX_201309EXECUTEDATE | 17356 | | 71 (0)| 00:00:01 |
| 50 | TABLE ACCESS FULL | tmp1060 | 8168 | 98016 | 29 (0)| 00:00:01 |
|* 51 | INDEX UNIQUE SCAN | PK_TB201309_CONGOODSDETAIL | 1 | | 1 (0)| 00:00:01 |
| 52 | TABLE ACCESS BY INDEX ROWID | TB201309_CONGOODSDETAIL | 1 | 34 | 2 (0)| 00:00:01 |
| 53 | VIEW | | 52 | 1508 | 33362 (1)| 00:06:41 |
| 54 | NESTED LOOPS | | | | | |
| 55 | NESTED LOOPS | | 52 | 6656 | 33362 (1)| 00:06:41 |
|* 56 | HASH JOIN | | 393 | 36942 | 32575 (1)| 00:06:31 |
| 57 | TABLE ACCESS FULL | tmp1060 | 8168 | 98016 | 29 (0)| 00:00:01 |
|* 58 | HASH JOIN | | 9473 | 758K| 32546 (1)| 00:06:31 |
| 59 | NESTED LOOPS | | | | | |
| 60 | NESTED LOOPS | | 9473 | 490K| 32083 (1)| 00:06:25 |
| 61 | TABLE ACCESS BY INDEX ROWID| TBCATTODEPARTMENT | 16 | 240 | 16 (0)| 00:00:01 |
|* 62 | INDEX RANGE SCAN | IDX$$_3F470002 | 16 | | 1 (0)| 00:00:01 |
|* 63 | INDEX RANGE SCAN | IDX_09$DEPTCODE | 2496 | | 10 (0)| 00:00:01 |
|* 64 | TABLE ACCESS BY INDEX ROWID | TB201309_DEPTCONGOODS | 593 | 22534 | 2004 (1)| 00:00:25 |
| 65 | TABLE ACCESS BY INDEX ROWID | TB201309_CONGOODSBILL | 17356 | 491K| 462 (1)| 00:00:06 |
|* 66 | INDEX RANGE SCAN | IDX_201309EXECUTEDATE | 17356 | | 71 (0)| 00:00:01 |
|* 67 | INDEX UNIQUE SCAN | PK_TB201309_CONGOODSDETAIL | 1 | | 1 (0)| 00:00:01 |
| 68 | TABLE ACCESS BY INDEX ROWID | TB201309_CONGOODSDETAIL | 1 | 34 | 2 (0)| 00:00:01 |
|* 69 | INDEX RANGE SCAN | IND_DGSN_GOODSCODE | 168 | | 3 (0)| 00:00:01 |
| 70 | TABLE ACCESS BY INDEX ROWID | tbdgs | 168 | 10416 | 122 (0)| 00:00:02 |
------------------------------------------------------------------------------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
1 - access("GS"."DEPTCODE"="DEPTS"."DEPTCODE" AND "GS"."DEPTTYPE"="DEPTS"."DEPTTYPE")
4 - filter("DEPTCATITEMCODE"='0004')
5 - access("NODECODE"='1329')
12 - access("JT"."BILLNUMBER"="FL"."BILLNUMBER" AND "JT"."DEPTCODE"="FL"."DEPTCODE" AND
"JT"."GOODSCODE"="FL"."GOODSCODE")
17 - access("T"."BILLNUMBER"="M"."BILLNUMBER")
19 - access("M"."EXECUTEDATE"='20130924')
21 - filter("G"."DEPTCODE"='1329' AND "G"."DEPTTYPE"=1)
22 - access("M"."BILLNUMBER"="G"."BILLNUMBER")
23 - access("M"."BILLNUMBER"="E"."BILLNUMBER" AND "G"."MAINGOODSID"="E"."INSIDEID")
30 - access("M"."BILLNUMBER"="T"."BILLNUMBER")
32 - access("M"."EXECUTEDATE"='20130924')
34 - filter("G"."DEPTTYPE"=0)
35 - access("M"."BILLNUMBER"="G"."BILLNUMBER")
36 - access("G"."DEPTCODE"="D"."DEPTCATEGORYCODE" AND "G"."CATEGORYITEMCODE"="D"."DEPTCATITEMCODE" AND
"D"."NODECODE"='1329')
37 - access("M"."BILLNUMBER"="E"."BILLNUMBER" AND "G"."MAINGOODSID"="E"."INSIDEID")
40 - access("JT"."BILLNUMBER"="FL"."BILLNUMBER" AND "JT"."DEPTCODE"="FL"."DEPTCODE" AND
"JT"."GOODSCODE"="FL"."GOODSCODE")
44 - access("T"."BILLNUMBER"="M"."BILLNUMBER")
45 - access("M"."BILLNUMBER"="G"."BILLNUMBER")
46 - filter("G"."DEPTTYPE"=1)
47 - access("G"."DEPTCODE"='1329')
49 - access("M"."EXECUTEDATE"='20130924')
51 - access("M"."BILLNUMBER"="E"."BILLNUMBER" AND "G"."MAINGOODSID"="E"."INSIDEID")
56 - access("M"."BILLNUMBER"="T"."BILLNUMBER")
58 - access("M"."BILLNUMBER"="G"."BILLNUMBER")
62 - access("D"."NODECODE"='1329')
63 - access("G"."DEPTCODE"="D"."DEPTCATEGORYCODE")
64 - filter("G"."DEPTTYPE"=0 AND "G"."CATEGORYITEMCODE"="D"."DEPTCATITEMCODE")
66 - access("M"."EXECUTEDATE"='20130924')
67 - access("M"."BILLNUMBER"="E"."BILLNUMBER" AND "G"."MAINGOODSID"="E"."INSIDEID")
69 - access("GS"."GOODSCODE"="GCON"."GOODSCODE")
Statistics
----------------------------------------------------------
1 recursive calls
0 db block gets
37317 consistent gets
0 physical reads
0 redo size
19341 bytes sent via SQL*Net to client
2894 bytes received via SQL*Net from client
21 SQL*Net roundtrips to/from client
0 sorts (memory)
0 sorts (disk)
287 rows processed
SQL> SELECT GS.* 2 FROM "xxx".tbdgs GS, 3 (SELECT COALESCE (JT.GoodsCode, FL.GoodsCode) GoodsCode 4 FROM (SELECT E.GoodsCode, 5 G.BILLNUMBER, 6 G.MAINGOODSID, 7 G.INSIDEID, 8 G.DEPTTYPE, 9 G.CATEGORYITEMCODE, 10 G.DEPTCODE, 11 G.PRICEMODE, 12 G.PURCHPRICE, 13 G.WITHHOLDINGRATES, 14 G.MAXPURCHPRICE, 15 G.RATE, 16 G.SUPPLYGOODSTIME, 17 G.COUNTERCODE, 18 G.PRICECOMPENSATYPE, 19 G.YPRICEMODE, 20 G.YPURCHPRICE, 21 G.YWITHHOLDINGRATES, 22 G.YHIGHPURCHPRICE, 23 G.SGSUPPLIERRATE, 24 G.VIPSUPPLIERRATE, 25 G.TEMPBEGINDATE, 26 G.TEMPENDDATE, 27 G.TEMPRATE 28 FROM (SELECT m.BillNumber 29 FROM "xxx".TB201308_ConGoodsBill M, tmp1060 t 30 WHERE t.BillNumber = m.BillNumber 31 AND M.ExecuteDate = '20130924') M, 32 (SELECT G.BILLNUMBER, 33 G.MAINGOODSID, 34 G.INSIDEID, 35 G.DEPTTYPE, 36 G.CATEGORYITEMCODE, 37 G.DEPTCODE, 38 G.PRICEMODE, 39 G.PURCHPRICE, 40 G.WITHHOLDINGRATES, 41 G.MAXPURCHPRICE, 42 G.RATE, 43 G.SUPPLYGOODSTIME, 44 G.COUNTERCODE, 45 G.PRICECOMPENSATYPE, 46 G.YPRICEMODE, 47 G.YPURCHPRICE, 48 G.YWITHHOLDINGRATES, 49 G.YHIGHPURCHPRICE, 50 G.SGSUPPLIERRATE, 51 G.VIPSUPPLIERRATE, 52 G.TempBeginDate, 53 G.TempEndDate, 54 G.TempRate 55 FROM "xxx".TB201308_DeptConGoods G 56 WHERE G.DeptType = 1 AND G.DeptCode = '1329') G, 57 "xxx".TB201308_ConGoodsDetail E 58 WHERE M.BillNumber = G.BillNumber 59 AND M.BillNumber = E.BillNumber 60 AND G.MainGoodsID = E.InsideID) JT 61 FULL JOIN 62 (SELECT /*+ index(G IDX_09$DEPTCODE) index(E PK_TB201309_CONGOODSDETAIL) */ 63 E.GoodsCode, 64 G.BILLNUMBER, 65 G.MAINGOODSID, 66 G.INSIDEID, 67 G.DEPTTYPE, 68 G.CATEGORYITEMCODE, 69 G.DEPTCODE, 70 G.PRICEMODE, 71 G.PURCHPRICE, 72 G.WITHHOLDINGRATES, 73 G.MAXPURCHPRICE, 74 G.RATE, 75 G.SUPPLYGOODSTIME, 76 G.COUNTERCODE, 77 G.PRICECOMPENSATYPE, 78 G.YPRICEMODE, 79 G.YPURCHPRICE, 80 G.YWITHHOLDINGRATES, 81 G.YHIGHPURCHPRICE, 82 G.SGSUPPLIERRATE, 83 G.VIPSUPPLIERRATE, 84 G.TEMPBEGINDATE, 85 G.TEMPENDDATE, 86 G.TEMPRATE 87 FROM (SELECT m.BillNumber 88 FROM "xxx".TB201308_ConGoodsBill M, tmp1060 T 89 WHERE m.BillNumber = t.BillNumber 90 AND M.ExecuteDate = '20130924') M, 91 "xxx".TB201308_DeptConGoods G, 92 "xxx".tbCatToDepartment D, 93 "xxx".TB201308_ConGoodsDetail E 94 WHERE M.BillNumber = G.BillNumber 95 AND M.BillNumber = E.BillNumber 96 AND G.DeptType = 0 97 AND D.NodeCode = '1329' 98 AND G.CategoryItemCode = D.DeptCatItemCode 99 AND G.DeptCode = D.DeptCategoryCode 100 AND G.MainGoodsID = E.InsideID) FL 101 ON JT.BillNumber = FL.BillNumber 102 AND JT.DeptCode = FL.DeptCode 103 AND JT.GoodsCode = FL.GoodsCode 104 UNION ALL 105 SELECT COALESCE (JT.GoodsCode, FL.GoodsCode) GoodsCode 106 FROM (SELECT E.GoodsCode, 107 G.BILLNUMBER, 108 G.MAINGOODSID, 109 G.INSIDEID, 110 G.DEPTTYPE, 111 G.CATEGORYITEMCODE, 112 G.DEPTCODE, 113 G.PRICEMODE, 114 G.PURCHPRICE, 115 G.WITHHOLDINGRATES, 116 G.MAXPURCHPRICE, 117 G.RATE, 118 G.SUPPLYGOODSTIME, 119 G.COUNTERCODE, 120 G.PRICECOMPENSATYPE, 121 G.YPRICEMODE, 122 G.YPURCHPRICE, 123 G.YWITHHOLDINGRATES, 124 G.YHIGHPURCHPRICE, 125 G.SGSUPPLIERRATE, 126 G.VIPSUPPLIERRATE, 127 G.TEMPBEGINDATE, 128 G.TEMPENDDATE, 129 G.TEMPRATE 130 FROM (SELECT m.BillNumber 131 FROM "xxx".TB201309_ConGoodsBill M, tmp1060 t 132 WHERE t.BillNumber = m.BillNumber 133 AND M.ExecuteDate = '20130924') M, 134 (SELECT G.BILLNUMBER, 135 G.MAINGOODSID, 136 G.INSIDEID, 137 G.DEPTTYPE, 138 G.CATEGORYITEMCODE, 139 G.DEPTCODE, 140 G.PRICEMODE, 141 G.PURCHPRICE, 142 G.WITHHOLDINGRATES, 143 G.MAXPURCHPRICE, 144 G.RATE, 145 G.SUPPLYGOODSTIME, 146 G.COUNTERCODE, 147 G.PRICECOMPENSATYPE, 148 G.YPRICEMODE, 149 G.YPURCHPRICE, 150 G.YWITHHOLDINGRATES, 151 G.YHIGHPURCHPRICE, 152 G.SGSUPPLIERRATE, 153 G.VIPSUPPLIERRATE, 154 G.TempBeginDate, 155 G.TempEndDate, 156 G.TempRate 157 FROM "xxx".TB201309_DeptConGoods G 158 WHERE G.DeptType = 1 AND G.DeptCode = '1329') G, 159 "xxx".TB201309_ConGoodsDetail E 160 WHERE M.BillNumber = G.BillNumber 161 AND M.BillNumber = E.BillNumber 162 AND G.MainGoodsID = E.InsideID) JT 163 FULL JOIN 164 (SELECT /*+ index(G IDX_09$DEPTCODE) index(E PK_TB201309_CONGOODSDETAIL) */ 165 E.GoodsCode, 166 G.BILLNUMBER, 167 G.MAINGOODSID, 168 G.INSIDEID, 169 G.DEPTTYPE, 170 G.CATEGORYITEMCODE, 171 G.DEPTCODE, 172 G.PRICEMODE, 173 G.PURCHPRICE, 174 G.WITHHOLDINGRATES, 175 G.MAXPURCHPRICE, 176 G.RATE, 177 G.SUPPLYGOODSTIME, 178 G.COUNTERCODE, 179 G.PRICECOMPENSATYPE, 180 G.YPRICEMODE, 181 G.YPURCHPRICE, 182 G.YWITHHOLDINGRATES, 183 G.YHIGHPURCHPRICE, 184 G.SGSUPPLIERRATE, 185 G.VIPSUPPLIERRATE, 186 G.TEMPBEGINDATE, 187 G.TEMPENDDATE, 188 G.TEMPRATE 189 FROM (SELECT m.BillNumber 190 FROM "xxx".TB201309_ConGoodsBill M, tmp1060 T 191 WHERE m.BillNumber = t.BillNumber 192 AND M.ExecuteDate = '20130924') M, 193 "xxx".TB201309_DeptConGoods G, 194 "xxx".tbCatToDepartment D, 195 "xxx".TB201309_ConGoodsDetail E 196 WHERE M.BillNumber = G.BillNumber 197 AND M.BillNumber = E.BillNumber 198 AND G.DeptType = 0 199 AND D.NodeCode = '1329' 200 AND G.CategoryItemCode = D.DeptCatItemCode 201 AND G.DeptCode = D.DeptCategoryCode 202 AND G.MainGoodsID = E.InsideID) FL 203 ON JT.BillNumber = FL.BillNumber 204 AND JT.DeptCode = FL.DeptCode 205 AND JT.GoodsCode = FL.GoodsCode) GCON 206 WHERE EXISTS 207 (SELECT /*+ hash_sj(GS depts) */ 1 208 FROM (SELECT 0 DeptType, DeptCategoryCode DeptCode 209 FROM "xxx".tbCatToDepartment 210 WHERE NodeCode = '1329' AND DeptCatItemCode = '0004' 211 UNION ALL 212 SELECT 1 DeptType, '1329' DeptCode FROM DUAL) depts 213 WHERE GS.DeptCode = depts.DeptCode 214 AND GS.DeptType = depts.DeptType) 215 AND GS.GoodsCode = GCON.GoodsCode; 287 rows selected. Elapsed: 00:03:06.24 Execution Plan ---------------------------------------------------------- Plan hash value: 1794864797 ---------------------------------------------------------------------------------------------------------------------- | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time | ---------------------------------------------------------------------------------------------------------------------- | 0 | SELECT STATEMENT | | 59 | 4838 | 60367 (1)| 00:12:05 | |* 1 | HASH JOIN | | 59 | 4838 | 60367 (1)| 00:12:05 | | 2 | VIEW | | 1256 | 11304 | 55113 (1)| 00:11:02 | | 3 | UNION-ALL | | | | | | | 4 | VIEW | VW_FOJ_0 | 4 | 72 | 204 (1)| 00:00:03 | |* 5 | HASH JOIN FULL OUTER | | 4 | 232 | 204 (1)| 00:00:03 | | 6 | VIEW | | 1 | 29 | 82 (2)| 00:00:01 | |* 7 | HASH JOIN | | 1 | 128 | 82 (2)| 00:00:01 | | 8 | NESTED LOOPS | | | | | | | 9 | NESTED LOOPS | | 1 | 116 | 63 (0)| 00:00:01 | | 10 | NESTED LOOPS | | 3 | 246 | 57 (0)| 00:00:01 | | 11 | NESTED LOOPS | | 716 | 47972 | 57 (0)| 00:00:01 | | 12 | TABLE ACCESS BY INDEX ROWID | TB201308_CONGOODSBILL | 23 | 667 | 4 (0)| 00:00:01 | |* 13 | INDEX RANGE SCAN | IDX_201308EXECUTEDATE | 23 | | 3 (0)| 00:00:01 | |* 14 | TABLE ACCESS BY INDEX ROWID | TB201308_DEPTCONGOODS | 31 | 1178 | 5 (0)| 00:00:01 | |* 15 | INDEX RANGE SCAN | IDX201308DEPTCONGOODS | 57 | | 2 (0)| 00:00:01 | |* 16 | INDEX UNIQUE SCAN | PK_TBCATTODEPARTMENT | 1 | 15 | 0 (0)| 00:00:01 | |* 17 | INDEX UNIQUE SCAN | PK_TB201308_CONGOODSDETAIL | 1 | | 1 (0)| 00:00:01 | | 18 | TABLE ACCESS BY INDEX ROWID | TB201308_CONGOODSDETAIL | 1 | 34 | 2 (0)| 00:00:01 | | 19 | TABLE ACCESS FULL | tmp1060 | 16956 | 198K| 18 (0)| 00:00:01 | | 20 | VIEW | | 4 | 116 | 122 (1)| 00:00:02 | |* 21 | HASH JOIN | | 4 | 436 | 122 (1)| 00:00:02 | | 22 | NESTED LOOPS | | | | | | | 23 | NESTED LOOPS | | 4 | 388 | 103 (0)| 00:00:02 | | 24 | NESTED LOOPS | | 23 | 1449 | 57 (0)| 00:00:01 | | 25 | TABLE ACCESS BY INDEX ROWID | TB201308_CONGOODSBILL | 23 | 667 | 4 (0)| 00:00:01 | |* 26 | INDEX RANGE SCAN | IDX_201308EXECUTEDATE | 23 | | 3 (0)| 00:00:01 | |* 27 | TABLE ACCESS BY INDEX ROWID | TB201308_DEPTCONGOODS | 1 | 34 | 5 (0)| 00:00:01 | |* 28 | INDEX RANGE SCAN | IDX201308DEPTCONGOODS | 57 | | 2 (0)| 00:00:01 | |* 29 | INDEX UNIQUE SCAN | PK_TB201308_CONGOODSDETAIL | 1 | | 1 (0)| 00:00:01 | | 30 | TABLE ACCESS BY INDEX ROWID | TB201308_CONGOODSDETAIL | 1 | 34 | 2 (0)| 00:00:01 | | 31 | TABLE ACCESS FULL | tmp1060 | 16956 | 198K| 18 (0)| 00:00:01 | | 32 | VIEW | VW_FOJ_1 | 1252 | 22536 | 54909 (1)| 00:10:59 | |* 33 | HASH JOIN FULL OUTER | | 1252 | 72616 | 54909 (1)| 00:10:59 | | 34 | VIEW | | 104 | 3016 | 3387 (1)| 00:00:41 | | 35 | NESTED LOOPS | | | | | | | 36 | NESTED LOOPS | | 104 | 11336 | 3387 (1)| 00:00:41 | |* 37 | HASH JOIN | | 788 | 59100 | 1810 (1)| 00:00:22 | |* 38 | TABLE ACCESS BY INDEX ROWID | TB201309_DEPTCONGOODS | 807 | 27438 | 1328 (1)| 00:00:16 | |* 39 | INDEX RANGE SCAN | IDX_09$DEPTCODE | 1652 | | 8 (0)| 00:00:01 | |* 40 | HASH JOIN | | 16956 | 678K| 481 (1)| 00:00:06 | | 41 | TABLE ACCESS FULL | tmp1060 | 16956 | 198K| 18 (0)| 00:00:01 | | 42 | TABLE ACCESS BY INDEX ROWID | TB201309_CONGOODSBILL | 17356 | 491K| 462 (1)| 00:00:06 | |* 43 | INDEX RANGE SCAN | IDX_201309EXECUTEDATE | 17356 | | 71 (0)| 00:00:01 | |* 44 | INDEX UNIQUE SCAN | PK_TB201309_CONGOODSDETAIL | 1 | | 1 (0)| 00:00:01 | | 45 | TABLE ACCESS BY INDEX ROWID | TB201309_CONGOODSDETAIL | 1 | 34 | 2 (0)| 00:00:01 | | 46 | VIEW | | 1252 | 36308 | 51522 (1)| 00:10:19 | |* 47 | HASH JOIN | | 1252 | 156K| 51522 (1)| 00:10:19 | | 48 | NESTED LOOPS | | | | | | | 49 | NESTED LOOPS | | 1252 | 141K| 51503 (1)| 00:10:19 | |* 50 | HASH JOIN | | 9473 | 758K| 32546 (1)| 00:06:31 | | 51 | NESTED LOOPS | | | | | | | 52 | NESTED LOOPS | | 9473 | 490K| 32083 (1)| 00:06:25 | | 53 | TABLE ACCESS BY INDEX ROWID| TBCATTODEPARTMENT | 16 | 240 | 16 (0)| 00:00:01 | |* 54 | INDEX RANGE SCAN | IDX$$_3F470002 | 16 | | 1 (0)| 00:00:01 | |* 55 | INDEX RANGE SCAN | IDX_09$DEPTCODE | 2496 | | 10 (0)| 00:00:01 | |* 56 | TABLE ACCESS BY INDEX ROWID | TB201309_DEPTCONGOODS | 593 | 22534 | 2004 (1)| 00:00:25 | | 57 | TABLE ACCESS BY INDEX ROWID | TB201309_CONGOODSBILL | 17356 | 491K| 462 (1)| 00:00:06 | |* 58 | INDEX RANGE SCAN | IDX_201309EXECUTEDATE | 17356 | | 71 (0)| 00:00:01 | |* 59 | INDEX UNIQUE SCAN | PK_TB201309_CONGOODSDETAIL | 1 | | 1 (0)| 00:00:01 | | 60 | TABLE ACCESS BY INDEX ROWID | TB201309_CONGOODSDETAIL | 1 | 34 | 2 (0)| 00:00:01 | | 61 | TABLE ACCESS FULL | tmp1060 | 16956 | 198K| 18 (0)| 00:00:01 | | 62 | NESTED LOOPS | | | | | | | 63 | NESTED LOOPS | | 17780 | 1267K| 5253 (1)| 00:01:04 | | 64 | VIEW | | 2 | 22 | 18 (0)| 00:00:01 | | 65 | HASH UNIQUE | | 1 | 15 | 18 (12)| 00:00:01 | | 66 | UNION-ALL | | | | | | |* 67 | TABLE ACCESS BY INDEX ROWID | TBCATTODEPARTMENT | 1 | 15 | 16 (0)| 00:00:01 | |* 68 | INDEX RANGE SCAN | IDX$$_3F470002 | 16 | | 1 (0)| 00:00:01 | | 69 | FAST DUAL | | 1 | | 2 (0)| 00:00:01 | |* 70 | INDEX RANGE SCAN | INDDEPTTYPECODE | 17780 | | 575 (1)| 00:00:07 | | 71 | TABLE ACCESS BY INDEX ROWID | tbdgs | 17780 | 1076K| 5234 (1)| 00:01:03 | ---------------------------------------------------------------------------------------------------------------------- Predicate Information (identified by operation id): --------------------------------------------------- 1 - access("GS"."GOODSCODE"="GCON"."GOODSCODE") 5 - access("JT"."BILLNUMBER"="FL"."BILLNUMBER" AND "JT"."DEPTCODE"="FL"."DEPTCODE" AND "JT"."GOODSCODE"="FL"."GOODSCODE") 7 - access("M"."BILLNUMBER"="T"."BILLNUMBER") 13 - access("M"."EXECUTEDATE"='20130924') 14 - filter("G"."DEPTTYPE"=0) 15 - access("M"."BILLNUMBER"="G"."BILLNUMBER") 16 - access("G"."DEPTCODE"="D"."DEPTCATEGORYCODE" AND "G"."CATEGORYITEMCODE"="D"."DEPTCATITEMCODE" AND "D"."NODECODE"='1329') 17 - access("M"."BILLNUMBER"="E"."BILLNUMBER" AND "G"."MAINGOODSID"="E"."INSIDEID") 21 - access("T"."BILLNUMBER"="M"."BILLNUMBER") 26 - access("M"."EXECUTEDATE"='20130924') 27 - filter("G"."DEPTCODE"='1329' AND "G"."DEPTTYPE"=1) 28 - access("M"."BILLNUMBER"="G"."BILLNUMBER") 29 - access("M"."BILLNUMBER"="E"."BILLNUMBER" AND "G"."MAINGOODSID"="E"."INSIDEID") 33 - access("JT"."BILLNUMBER"="FL"."BILLNUMBER" AND "JT"."DEPTCODE"="FL"."DEPTCODE" AND "JT"."GOODSCODE"="FL"."GOODSCODE") 37 - access("M"."BILLNUMBER"="G"."BILLNUMBER") 38 - filter("G"."DEPTTYPE"=1) 39 - access("G"."DEPTCODE"='1329') 40 - access("T"."BILLNUMBER"="M"."BILLNUMBER") 43 - access("M"."EXECUTEDATE"='20130924') 44 - access("M"."BILLNUMBER"="E"."BILLNUMBER" AND "G"."MAINGOODSID"="E"."INSIDEID") 47 - access("M"."BILLNUMBER"="T"."BILLNUMBER") 50 - access("M"."BILLNUMBER"="G"."BILLNUMBER") 54 - access("D"."NODECODE"='1329') 55 - access("G"."DEPTCODE"="D"."DEPTCATEGORYCODE") 56 - filter("G"."DEPTTYPE"=0 AND "G"."CATEGORYITEMCODE"="D"."DEPTCATITEMCODE") 58 - access("M"."EXECUTEDATE"='20130924') 59 - access("M"."BILLNUMBER"="E"."BILLNUMBER" AND "G"."MAINGOODSID"="E"."INSIDEID") 67 - filter("DEPTCATITEMCODE"='0004') 68 - access("NODECODE"='1329') 70 - access("GS"."DEPTTYPE"="DEPTS"."DEPTTYPE" AND "GS"."DEPTCODE"="DEPTS"."DEPTCODE") Note ----- - dynamic sampling used for this statement (level=2) Statistics ---------------------------------------------------------- 13 recursive calls 0 db block gets 102510 consistent gets 21745 physical reads 0 redo size 19942 bytes sent via SQL*Net to client 2836 bytes received via SQL*Net from client 21 SQL*Net roundtrips to/from client 0 sorts (memory) 0 sorts (disk) 287 rows processed SQL> SQL>