sample 1:




[sql]​view plain​​​ ​​copy​


  1. select /*+INDEX(t IDX_SEL_ADD_DATE)*/ t.own_sys, count(1)
  2. from std_entp_login t
  3. where t.add_date >
  4. to_date('2010-12-28 00:00:00', 'yyyy-mm-dd hh24:mi:ss')
  5. and t.add_date <
  6. to_date('2010-12-28 23:59:59', 'yyyy-mm-dd hh24:mi:ss')
  7. group by t.own_sys



用到别名时,/*+INDEX(TABLE INDEX_NAME)*/中的TABLE一定是别名,否则不走执行强制索引。