Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
Tonekene
Starting Member
6 Posts |
Posted - 2014-10-03 : 10:37:14
|
good morning everyoneI have few tables i join together all the time, and i join it on 7 fields (division, dept, dpdept, dpgroup, dpsector, acct, year) all fields are varchar. all indexed queries run under 2 seconds, it is acceptable and all that. But i still want to improve it and i would like to know is there a way to somehow hash or combine these fields into one, maybe int tyoe field, and then join on it?what do u think?thanks |
|
gbritton
Master Smack Fu Yak Hacker
2780 Posts |
|
ScottPletcher
Aged Yak Warrior
550 Posts |
Posted - 2014-10-03 : 16:27:00
|
You don't need to combine them. Create a single index that has the keys in the order in which you specify them. For example, if you always specify division, it can go first. As long as key values are present in order, SQL can seek to that location to start the search. As soon as even one key value is missing, SQL must scan every index row from that point forward. |
|
|
|
|
|
|
|