猿问

有个表80W的表和8w多表做链接有优化空间吗?

查询挺慢的,看看有什么优化空间:
select (
SELECT
'裝卸說明:'||BC.LOADING_DESC||' CY電話'||BC.TEL
FROM TM_BOOKING_CONTAINER TBC,TM_BOOKING TB,BK_CONTAINER BC
WHERE EXISTS (SELECT 1 FROM ST_FEEDER_CTN_LINK FL WHERE FL.ST_FEEDER_ID=SF.ST_FEEDER_ID AND TBC.BK_CONTAINER_ID=FL.BK_CONTAINER_ID)
AND TBC.TM_BOOKING_ID=TB.TM_BOOKING_ID
AND TBC.BK_CONTAINER_ID=BC.BK_CONTAINER_ID
AND TB.BUSIENSS_TYPE='VCY'
AND ROWNUM=1
)AS LOADING_DESC_CY_TEL,

SF.OTHER_REMARK,
SF.OCEAN_VESSEL_CODE||'/'||SF.OCEAN_VOYAGE AS OCEAN_VVL,
SF.OCEAN_POL_NAME
FROM ST_FEEDER SF
LEFT JOIN ST_FEEDER_GLOBAL SFG ON SFG.ST_FEEDER_ID=SF.ST_FEEDER_ID AND SFG.GLOBAL_TYPE='TW'
WHERE SF.ST_FEEDER_ID IN (SELECT COLUMN_VALUE FROM TABLE(F_STR2TYTABLE('0000000068fbc36d016903bd0bd20169', ',')))

select count(*) from TM_BOOKING_CONTAINER;--654935

select count(*) from TM_BOOKING;--652019

select count(*) from BK_CONTAINER;--8043211


收到一只叮咚
浏览 690回答 2
2回答

偶然的你

最好把执行计划发出来,才能进行进一步分析。

长风秋雁

从sql语句看,建议把AS LOADING_DESC_CY_TEL的子查询,转换到表连接语句中。
随时随地看视频慕课网APP

相关分类

Oracle
我要回答