1
可以優化此查詢嗎?優化SQL Server查詢
SELECT
tr.transferfrom, tr.transferto, br.id as 'BR_ID',tr.refno,
br.name as 'BR_NAME', br.code as 'BRANCH_CODE', tr.docno, tr.transdate,
stk.stockno,stk.salescat,tr.qty, tr.sprice,tr.qty*tr.sprice as 'GROSS_SALES'
FROM
TRANSFER tr
JOIN
branch br on tr.branchid = br.id
JOIN
stocks stk on tr.stockid=stk.id
WHERE
RIGHT(tr.refno,7) = 'ST00576' AND LEFT(tr.refno,2) = 89
AND stk.stockno = 'NS4370 CR - L';
點4沒有任何意義 - 在RIGHT(tr.refno,7)上設置索引。 – TomTom
你會怎麼做呢? –
@TomTom:以及單個基於函數的索引如何提供幫助?如果我們分離了列 - 我們可以創建'right_part_column + refno'組合索引。 – zerkms