Guest_imported
New member
- Jan 1, 1970
- 0
How's the SQL sintaxe using index? I'm using 3 tables in my query and it's awfully slow. How can I inform the index to be used in such query?
Here is the query:
select distinct r.nmfuncio as nome,
r.dsendfun as endereco,
r.dscomple as Complemeto,
rhs.GS125.DSELEMEN as Bairro,
' ' as cidade,
' ' as estado,
r.nrtelefo as telefone,
r.dsponref as pontoreferencia,
' 'as empresa,
r.nrcarpon as matricula,
d.sgccusto as centrocusto
from rhs.rh002 r, linc.dbtab_tcust d, rhs.gs125
where rhs.gs125.CDEMPRES = 01 and
r.cdcencus = d.cdcustomag AND
r.cdsitatu = 1 and
rhs.gs125.cdtabela = 6289 and
rhs.gs125.CDELEMTO = cdbairro
order by nome
The indexs I wanna use are the following ones:
rhs.fkeyrh002 (KEYRH002) or
rhs.rh00201(CDEMPRES, CDFILIAL, NMFUNCIO, NRCARPON) or
rhs.00204(NRCARPON).
Here is the query:
select distinct r.nmfuncio as nome,
r.dsendfun as endereco,
r.dscomple as Complemeto,
rhs.GS125.DSELEMEN as Bairro,
' ' as cidade,
' ' as estado,
r.nrtelefo as telefone,
r.dsponref as pontoreferencia,
' 'as empresa,
r.nrcarpon as matricula,
d.sgccusto as centrocusto
from rhs.rh002 r, linc.dbtab_tcust d, rhs.gs125
where rhs.gs125.CDEMPRES = 01 and
r.cdcencus = d.cdcustomag AND
r.cdsitatu = 1 and
rhs.gs125.cdtabela = 6289 and
rhs.gs125.CDELEMTO = cdbairro
order by nome
The indexs I wanna use are the following ones:
rhs.fkeyrh002 (KEYRH002) or
rhs.rh00201(CDEMPRES, CDFILIAL, NMFUNCIO, NRCARPON) or
rhs.00204(NRCARPON).