有谁知道如何优化这个查询?如果我运行此查询并且生成 11 行需要超过 10 分钟
SELECT DISTINCT th.e_id,
b_number,
TQH.supplier_id AS VENDOR_ID,
s.suppliername AS VENDOR_NAME,
BUYER_POS,
TQH.quotation_number AS QUOTATION_NO,
TQH.contact_person AS CONTRACTOR_REP,
TQD.tqd_currency_id AS CURRENCY_ID
FROM Tender_Header TH
INNER JOIN Tender_Quotation_Header TQH ON TH.e_id = TQH.e_id
INNER JOIN Tender_Quotation_Type TQT ON TQH.tqh_id = TQT.tqh_id
INNER JOIN Tender_Quotation_Detail TQD ON TQT.tqt_id = TQD.tqt_id
INNER JOIN EVPM.DBO.vwsupplier S ON TQH.supplier_id = S.supplierid
INNER JOIN Tender_Item TI ON TI.item_id = TQD.item_id
INNER JOIN Tender_Proposal TP ON tp.e_id = th.e_id
WHERE (TH.act_id = 46)
AND (ISNULL(TQD.is_copied, '0') = '0')
AND (tqd.tqd_result = 1
OR tqh.resultpackage = 1)
AND (b_number LIKE 'SM%'
OR b_number_ref LIKE 'SM%')
AND b_number NOT IN
(SELECT eproc_id
FROM newkimap.dbo.exp_mts_tender_main)