Reputation: 1581
For DB2...
table1.a is varchar(30) and has an index on it. table2.b is varchar(45) and has an index on it.
Will table1.a = table2.b
use the index on table1, table2, or both?
Although it would seem obvious that it should use both indexes, I'm asking because I believe on sybase, this would only use one of the indexes (I'm not sure which one).
I fully intend to test this out, but I am unable to presently.
Upvotes: 1
Views: 591
Reputation: 76
Use EXPLAIN on your query to determine what indexes it is using. For more information see this link:
Upvotes: 1
Reputation: 13583
It's been my experience on DB2 for Z that it won't, as data types must be identical -- the data type, precision, scale, and nullability of a column must match for joins to use them.
Upvotes: 1