1

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 ?

Community
  • 1
  • 1
Prasad Weera
  • 1,223
  • 3
  • 13
  • 25

1 Answers1

1

http://use-the-index-luke.com/sql/where-clause/the-equals-operator/concatenated-keys

This should answer both questions.

Attila Szasz
  • 3,033
  • 3
  • 25
  • 39