I have and joined between two tables like this:
......TB1 join TB2 on TB1.col1=TB2.col3 and TB1 .clo2=TB2.Col4
There a lot of records in TB2 ,so I wondered to make an index on Col3 and
Col4 of TB2.Now my question is that according to the join above it's better
to have a compound index on col3,col4 or each inividually?
Thanks for your help.
RayHi Ray,
I recommend you to create a composite Non clustered index on Col1 and Col2
of Table 1 , Col3 and Col4 of Table 2.
This index will be very good if you have a clustered index on Key column.
You can also use the Index tuning Wizard for Index recommendations. As well
see the Logical and Physical reads, Cpu usage before and
after the creation of index.
Thanks
Hari
SQL Server MVP
"RayAll" <RayAll@.microsft.com> wrote in message
news:%238E3mJjOFHA.3296@.TK2MSFTNGP15.phx.gbl...
>I have and joined between two tables like this:
> ......TB1 join TB2 on TB1.col1=TB2.col3 and TB1 .clo2=TB2.Col4
>
> There a lot of records in TB2 ,so I wondered to make an index on Col3 and
> Col4 of TB2.Now my question is that according to the join above it's
> better to have a compound index on col3,col4 or each inividually?
> Thanks for your help.
> Ray
>
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment