下面的查询需要14秒才能得出结果。有什么方法可以优化此查询。
SELECT DISTINCT L.F_T_CODE AS F_T_CODE, PHT.F_PHRAS AS F_PHRAS FROM PHRASE_LINK L
INNER JOIN PHRAS_TR PHT ON L.F_P_ID = PHT.F_P_ID
WHERE PHT.F_PHRAS LIKE '%a%'
AND PHT.F_LAN = 'EN' AND L.F_D_CODE != L.F_T_CODE ORDER BY PHT.F_PHRAS
OFFSET 100000 ROWS FETCH NEXT 10 ROWS ONLY;
答案 0 :(得分:0)
在同一张表上使用INNER JOIN尝试以下查询:
SELECT DISTINCT L.F_T_CODE AS F_T_CODE, PHT.F_PHRAS AS F_PHRAS
FROM PHRASE_LINK L
INNER JOIN PHRASE_LINK L1 ON L.F_D_CODE != L1.F_T_CODE
INNER JOIN PHRAS_TR PHT ON L.F_P_ID = PHT.F_P_ID
WHERE PHT.F_PHRAS LIKE '%a%' `enter code here`
AND PHT.F_LAN = 'EN' ORDER BY PHT.F_PHRAS
OFFSET 100000 ROWS FETCH NEXT 10 ROWS ONLY;