Subject | Query is not indexing |
---|---|
Author | Juarez A. Mendes |
Post date | 2005-05-05T03:02:34Z |
I have the following query
SELECT
SE.NOMESETOR,
CA.CATEGORIA,
SC.SUBCATEGORIA,
P.NOMEPRODUTO AS ITEM,
P.CODIGOEAN AS CODIGO,
SUM(P.TOTAL) AS TOTAL,
SUM(P.QUANTIDADE) as QUANTIDADE,
COALESCE(SUM(P.PRECOCUSTO),0) PRECOCUSTO,
FROM PRODVENDA P
LEFT OUTER JOIN PRODUTOS PCAD ON (PCAD.CODPRODUTO=P.CODPRODUTO)
LEFT OUTER JOIN VENDA V ON (V.REFVENDA=P.CODVENDA AND
V.DATAVENDAbetween :DATAINICIO AND :DATAFIM OR 2=0)
and P.CANCELADO=0 and V.TIPOREGISTRO=1)
LEFT OUTER JOIN SETOR SE ON (PCAD.CODSETOR=SE.CODSETOR)
LEFT OUTER JOIN CATEGORIA CA ON
(PCAD.CODCATEGORIA=CA.CODCATEGORIA) LEFT OUTER JOIN SUBCATEGORIA
SC ON (PCAD.CODSUBCATEGORIA=SC.CODSUBCAT)
GROUP BY 1,2,3,4,5
ORDER BY 1,3,4
her this working well but always when passing for a performance
analysis I do verify that PRODVENDA always appears in red in the
graph, did I already create indexes and did I turn off making several
tests but does it always continue in red showing researches not
indexed, does anybody know as could optimize that?
Thanks
Juarez A. Mendes
SELECT
SE.NOMESETOR,
CA.CATEGORIA,
SC.SUBCATEGORIA,
P.NOMEPRODUTO AS ITEM,
P.CODIGOEAN AS CODIGO,
SUM(P.TOTAL) AS TOTAL,
SUM(P.QUANTIDADE) as QUANTIDADE,
COALESCE(SUM(P.PRECOCUSTO),0) PRECOCUSTO,
FROM PRODVENDA P
LEFT OUTER JOIN PRODUTOS PCAD ON (PCAD.CODPRODUTO=P.CODPRODUTO)
LEFT OUTER JOIN VENDA V ON (V.REFVENDA=P.CODVENDA AND
V.DATAVENDAbetween :DATAINICIO AND :DATAFIM OR 2=0)
and P.CANCELADO=0 and V.TIPOREGISTRO=1)
LEFT OUTER JOIN SETOR SE ON (PCAD.CODSETOR=SE.CODSETOR)
LEFT OUTER JOIN CATEGORIA CA ON
(PCAD.CODCATEGORIA=CA.CODCATEGORIA) LEFT OUTER JOIN SUBCATEGORIA
SC ON (PCAD.CODSUBCATEGORIA=SC.CODSUBCAT)
GROUP BY 1,2,3,4,5
ORDER BY 1,3,4
her this working well but always when passing for a performance
analysis I do verify that PRODVENDA always appears in red in the
graph, did I already create indexes and did I turn off making several
tests but does it always continue in red showing researches not
indexed, does anybody know as could optimize that?
Thanks
Juarez A. Mendes