Take the tour ×  I have a Composite Primary key which is
combination of Column1, and Column2. What would be the
difference if I have Composite key with Column2, and Column1.
Does it even really matter which order you set columns?
share|improve this question Read here:
asktom.oracle.com/pls/asktom/… –  A.B.Cade Jul 16 '12 at 14:20
add comment  migrated from stackoverflow.com Jul 17 '12 at 14:03
This question came from our site for professional and enthusiast
programmers.  2 Answers  It does, but perhaps not in the way you
might expect.  Given col1 and col2, people's initial instinct is
to put the more selective column first.  But, that's almost
always irrelevant.  First, you need to consider how the index
will be used in your SQL statements. If some SQLs only specify
col1, then col1 should probably be first. If all SQLs will
always specify both columns in the where predicate, then it
doesn't matter which comes first.  But, what if most of the SQLs
specify both col1 and col2, and a few provide only col1 or co