sadasafsdfdsf
sadasafsdfdsf
2014-07-03 17:29

oracle索引多表查询SQL

已采纳

[color=red][/color]一下是SQL查询语句
SELECT f.bill_num as B_LNO,
f.bill_date as DATEB_L,
f.ship_name as SHIP_NAME,
B.tc_num_tc as CERTIFICATENO,
'' as ORDINE,
'' as CLIENTE,
B.prod_name AS FAMIGLIA,
B.SPEC AS QUALITY,
B.mat_no AS COILNO,
B.mat_no AS PACKNO,
'1' as QTY,
B.HEAT_No AS HEATNO,
B.THICK_TC AS THICK,
B.WIDTH_TC AS WIDTH,
B.LENTH_TC AS LENGTH,
B.WEIGHT_ACTIVE AS MASS,
p.WEIGHT_THEO * 1000 as GROSS_WEIGHT,
B.order_no as ORDER_NUM,
B.cust_ord_num as CUSTOMER_ORDER_NUM
FROM bodba.t_lfqm_td00p B,
bodba.TSOESF4 f,
bodba.TSOESF5 m,
bodba.lgs_stack_material p,
bodba.lgs_stack_data p1
WHERE p.pack_num = B.mat_no
AND B.mat_no in ('2DB02060200',
'2DB02062200',
'2DB03022100',
'2DB03022200',
'2DB02044200',
'2DB02045100',
'2DB02045200',
'2DB02047100',
'2DB02047200',
'2DB02048100',
'2DB02049100',
'2DB02049200',
'2DB02050100',
'2DB02050200',
'2DB02060100',
'2DB02042100',
'2DB02043100',
'2DB02044100',
'2DB02048200',
'2DB02059100',
'2DB02059200',
'2DB02058100',
'2DB02058200',
'2DB02042200',
'2DB02043200')
and B.order_no = m.order_num
AND f.contract_num = m.contract_num
and f.lot_no = m.lot_no
and f.SHIP_LOT_NUM = 'B3011507'
and p1.order_num = 'JC1TX12002'
and p.stacking_rec_num = p1.stacking_rec_num
and p.manu_id = p1.manu_id
order by B.order_no, B.mat_no

下面是每张表的对应索引表
t_lfqm_td00p
--PK_T_LFQM_TD00P
--T_LFQM_TD00P_IDX1

TSOESF4
--TSOESF4_PK
--TSOESF4_IDX_2
--TSOESF4_IDX_3
--TSOESF5_IDX_1
--TSOESF4_IDX_4

TSOESF5
--TSOESF5_PK
--IDX_INVOICE_NUM_INV
--TSOESF5_IDX_4
--TSOESF5_IDX_5
--TSOESF5_IDX_6
--TSOESF5_IDX_7

lgs_stack_material
--PK_STACK_MATERIAL
--IDX_STACKING_REC_NUM_D
--PK_PACK_NUM_D
--PK_INVOICE_9
--PK_INVOICE_13
--LGS_STACK_MATER_INDX1

lgs_stack_data
--IDX_STACKING_REC_NUM
--IDX_ORDER_NUM
--LGS_STACK_DATA_INDX6
--LGS_STACK_DATA_INDX7
--LGS_STACK_DATA_INDX1
--LGS_STACK_DATA_INDX2
--LGS_STACK_DATA_INDX3
--LGS_STACK_DATA_INDX4
--LGS_STACK_DATA_INDX5
--LGS_STACK_DATA_INDX8

然后问题是我想知道我上面的查询语句是否用到了索引查询?如果没有我如何以以上查询语句使用到索引查询?如果使用到了那么查询速度可否再次提升?

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答

1条回答

  • joaboo joaboo 7年前

    用没用索引得看执行计划啊,最简单的方式就是在plsq中F5一下.

    点赞 评论 复制链接分享

相关推荐