Truy vấn chọn có thể sử dụng các chỉ mục khác nhau nếu thay đổi giá trị của điều kiện ở đâu không?Truy vấn giống nhau sử dụng các chỉ mục khác nhau?
Hai truy vấn sau đây sử dụng các chỉ số khác nhau và sự khác biệt duy nhất là giá trị của điều kiện và typeenvoi = 'KHẨU' hoặc và typeenvoi = 'MAIL'
select numenvoi,adrdest,nomdest,etat,nbessais,numappel,description,typeperiode,datedebut,datefin,codeetat,codecontrat,typeenvoi,dateentree,dateemission,typedoc,numdiffusion,nature,commentaire,criselcomp,crisite,criservice,chrono,codelangueetat,piecejointe, sujetmail, textemail
from v_envoiautomate
where etat=0 and typeenvoi='EXPORT'
and nbessais<1
select numenvoi,adrdest,nomdest,etat,nbessais,numappel,description,typeperiode,datedebut,datefin,codeetat,codecontrat,typeenvoi,dateentree,dateemission,typedoc,numdiffusion,nature,commentaire,criselcomp,crisite,criservice,chrono,codelangueetat,piecejointe, sujetmail, textemail
from v_envoiautomate
where etat=0 and typeenvoi='MAIL'
and nbessais<1
bất cứ ai có thể cho tôi một lời giải thích?
@Lazy Bobo: Bạn đúng trong lý do của bạn tuy nhiên tôi tin rằng "từ" bạn đang tìm kiếm là "chọn lọc" tức là tính chọn lọc của cột dựa trên phân phối các giá trị dữ liệu –