SQL: optimization/func(index_k)

From: Saad Ahmad <sahmad_at_mfa.com>
Date: 9 Mar 1995 04:06:50 GMT
Message-ID: <3jlusq$sqi_at_homer.alpha.net>


select something
from the_table
where

         some_func_giving_shift(sysdate) = 'shift_to_find' and
         S.SYSDAT between to_date($day_s, 'YYYY/MM/DD HH24MISS')
                     and to_date($day_e, 'YYYY/MM/DD HH24MISS')

--index on SYSDAT exists

The query does not use index since a function is applied to sysdat. The function returns '1', '2', or '3' depending on the "time" part of the sysdat field. If I can somehow force oracle to use the index even though the function is applied, I will get the right result since the statement is parsed from bottom up and the subset that is returned would be used as a candidate for the function thus giving me the right result

--


  • Saad Ahmad *
  • E-Mail: sahmad_at_mfa.com *
Received on Thu Mar 09 1995 - 05:06:50 CET

Original text of this message