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 |
|
brandonl
Yak Posting Veteran
58 Posts |
Posted - 2003-04-10 : 14:04:21
|
| I have queries that are performed on a daily basis on quite a few records-and I'm looking to create some indexes to speed it up. The basic table structure for all the tables is similar to the following:MachineName, Field1, Field2, Field3, etc...All the tables are joined by the MachineName field, and there are duplicate values in that field.The question I have is this:In the tables, one or two fields in each will be selected as the criteria for the query. In the indexs, should I only include the field(s) that will be selected from each table, or should I create the indexes with the MachineName and the field(s) that will be selected as well?Thanks for any assistance!~BrandonL |
|
|
X002548
Not Just a Number
15586 Posts |
Posted - 2003-04-10 : 14:26:13
|
I would create a non unique composite index per table, each with the first column being the MachineName. I would also "overload" the index with the columns you are selecting (if there's not a lot of them and they are not too big in size). This way it should perform an index only operation.Your statement:quote: there are duplicate values in that field
Does concern me though. It table A has dup values (say x occurs 3 times) and Table B has dup values (say x occurs 2 times), you'll end up with a cartesian product and have 6 rows as the rsult set.Brett8-) |
 |
|
|
|
|
|