Your query formatted so it is a bit more understandable:
select mh.MEMIDNUM
from INIT.MPI_MEMHEAD mh inner join
INIT.MPI_AUDHEAD ah
on ah.audrecno = mh.CAUDRECNO
where (au.audctime+0) >= to_date('01-JAN-14') AND (au.audctime+0) <= to_date('01-APR-14')
I don't fully understand the where
clause. The + 0
isn't doing anything. So, you should convert it to:
where au.audctime >= to_date('01-JAN-14') AND au.audctime <= to_date('01-APR-14')
Assuming that audctime
is in a date/time format, then the query engine can take advantage of an index. My recommendation would be to add the following two indexes:
INIT.MPI_AUDHEAD(audctime, audrecno)
INIT.MPI_MEMHEAD(CAUDRECNO, MEMIDNUM)
These are covering indexes, so all columns mentioned in the query are in the indexes. In addition, they should speed up the where
clause and the join
.