位置:首頁 > 軟件操作教程 > 數(shù)據(jù)分析 > SQL > 問題詳情

SQL操作應(yīng)用——復(fù)合索引最左前綴,并不是值SQL語句的where順序要和復(fù)合索引一致

提問人:ylm發(fā)布時間:2020-09-28

用戶中心建立了(login_name, passwd)的復(fù)合索引

select * from user where login_name=? and passwd=?
select * from user where passwd=? and login_name=?

都能夠命中索引

select * from user where login_name=?

也能命中索引,滿足復(fù)合索引最左前綴

select * from user where passwd=?

不能命中索引,不滿足復(fù)合索引最左前綴

繼續(xù)查找其他問題的答案?

相關(guān)視頻回答
回復(fù)(0)
返回頂部