Reputation: 1299
After reading THIS answer on Indexing of tables, a doubt came up. Think we have a table with two columns and neither is unique but the combination. SO if I add a unique key like this, UNIQUE KEY (col1,col2)
then how would the internal index file look like? I mean will it keep two separate b-trees or one single B-tree and if only one B-tree is made, then what would be the structure ?
And if my queries will be only on col1, then will this indexing be useful ?
Upvotes: 1
Views: 126
Reputation: 3073
http://use-the-index-luke.com/sql/where-clause/the-equals-operator/concatenated-keys
This should answer both questions.
Upvotes: 1