mysql,sqlserver強制使用指定索引查詢


mysql強制使用指定索引查詢

語法:
select * from table_name force index (index_name) where conditions;
使用 關鍵字 force

#########mysql強制使用指定索引查詢
SELECT * FROM `yrd_pay_flow`  FORCE INDEX(`idx_trxn_date`)
WHERE  trxn_date > '2017-08-12 59:59:59'  AND trxn_date < '2016-06-23 00:00:00';

 

SQLServer強制使用指定索引查詢

SQL語句范例:Select * From <SQL表格名稱> with (NoLock,Index=ix_ByDate) Where BillDate >= '' and BillDate < ''

SQL語句范例:Select * From <SQL表格名稱> with (NoLock,Index=ix_ByDate) Where BillDate >= '' and BillDate < ''

注: ix_ByBillDate為此表中根據字段BilLDate建立的字段索引。


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM