Lets say that a column will only be used for joining. (i.e. I won’t be ordering on the column, nor will a search for specific values in the column individually) … the only thing that I will use the column for is joining to another table.
If the database supports Hash Joins (which from my understanding don’t benefit from indexes) .. then wouldn’t the addition of an index be completely redundant? (and wasteful) ?
In SQL Server it will still prevent a
Key Lookup.If you
JOINon an unindexed field, the server needs to get the values for that field from the clustered index.If you
JOINon a NC index, the values can be obtained directly without loading all the data pages from the cluster (which really is the whole table).So essentially you save yourself a lot of IO as the first step filters down based on a very narrow index instead of on the entire table loaded from disk.