sql - Oracle Query Date Range -


This query takes 16 minutes is there a faster way?

  INIT.MPI_MEMHEAD.MEMIDNUM is selected from INIT.MPI_MEMHEAD at INIT.MPI_AUDHEAD INIT.MPI_AUDHEAD.audrecno = INIT.MPI_MEMHEAD.CAUDRECNO where INIT.MPI_AUDHEAD.audctime +0) & gt; = To_date ('01 -JAN-14 ') and (INIT.MPI_AUDHEAD.audctime + 0) & lt; = To_date ('01-APR-14 ')    

First of all, you "( INIT.MPI_AUDHEAD.audctime + 0) & gt; = to_date ('01 -JAN-14 ') and (INIT.MPI_AUDHEAD.audctime + 0) & lt; = to_date ('01 -APR-14') "to" Code> Where INIT.MPI_AUDHEAD.audctime between date '01 -JAN-14 'and date '01 - APR-14' ".

Second, if you have INIT If you want to always select this table in one quarter by MPI_AUDHEAD.audctime, you can change this table in a partition table by auditing it. As mentioned below:

  create MPI_Oddhead (Audit Date) range by audit (overtime) (less than the Partial payment payment value (TO_DATE ('2014-01-01 00:00:00' , 'Yay-MM-DD hh24: Mile: SS')) Tabspex TBS 01, Partition Part 02 Low Price (TO_DATE ('2014-04-01 00:00:00', 'YAY-MM-DD HH 24: Mile: SS ')) TABLESPACE tbs02,);   

)

Third, add an index to the audit.

For your reference.

Comments

Popular posts from this blog

Java - Error: no suitable method found for add(int, java.lang.String) -

java - JPA TypedQuery: Parameter value element did not match expected type -

c++ - static template member variable has internal linkage but is not defined -