title: Oracle Switching Plan of Execution to Wrong Index
body: <p>We had a performance issue in our production environment.</p>
  
  <p>We identified that Oracle was executing queries using a Index which is not correct.</p>
  
  <p>The queries have in their WHERE CLAUSE all the columns of the Primary Key (and nothing else).</p>
  
  <p>After rebuilding of Index and Gather Statistics, Oracle started using the PK_INDEX. And the plan of execution indicated Index Unique Scan.</p>
  
  <p>It worked fine for a while and then Oracle started using the Wrong Index again. The index that it uses now comprise of 2 Columns of which only 1 appears in the WHERE CLAUSE of the query. Now the plan of execution indicates INDEX RANGE SCAN and the system is very slow.</p>
  
  <p>Please let me know how we could get to the root of this issue.</p>