idh_hist query is very slow while searching with date

Discussão em 'StackOverflow' iniciado por fdantas, Agosto 11, 2016.

  1. fdantas

    fdantas Administrator Moderador

    I am trying to write a query to search thru MFG/PRO invoice table 'idh_hist' for specific date range. It is running very slow when added the date condition. But when I put off the date condition, it is very fast. Can you please suggest ways to write a query on idh_hist that runs reasonably faster with conditions.

    Following is my query:

    for each idh_hist no-lock where idh_domain = "d0002"
    and idh_due_date = TODAY:

    /* display code here... */

    end.


    Thanks in advance!

    Database Index:

    Flags Index Name Cnt Field Name
    ----- --------------------- ---- ---------------------
    idh_fsm_type 4 + idh_domain
    + idh_fsm_type
    + idh_nbr
    + idh_line

    pu idh_invln 4 + idh_domain
    + idh_inv_nbr
    + idh_nbr
    + idh_line

    idh_part 4 + idh_domain
    + idh_part
    + idh_inv_nbr
    + idh_line

    u oid_idh_hist 1 + oid_idh_hist

    Continue reading...

Compartilhe esta Página