If I've indexed field "A","B","C" with primary key, So do I still need to
index field "B"?That depends on how you access the table. If your WHERE clause looks this
this:
WHERE B = x
and you do this often you would probably benefit from another index on B
alone. If you do this:
WHERE A = y AND B = x
There is no need. The only time an index will use the columns in a compound
index that are not the first ones in the index expression is if it scans the
entire index. This is usually not the desired effect.
Andrew J. Kelly SQL MVP
"Bpk. Adi Wira Kusuma" <adi_wira_kusuma@.yahoo.com.sg> wrote in message
news:OAQMYfHvFHA.3896@.TK2MSFTNGP15.phx.gbl...
> If I've indexed field "A","B","C" with primary key, So do I still need to
> index field "B"?
>
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment