Subject Re: [firebird-support] Query is not indexing
Author Ann W. Harrison
Juarez A. Mendes wrote:
> I have the following query
>
> SELECT
> ...
> FROM PRODVENDA P
> LEFT OUTER JOIN PRODUTOS PCAD ON (PCAD.CODPRODUTO=P.CODPRODUTO)
> LEFT OUTER JOIN VENDA V ON (...)
> LEFT OUTER JOIN SETOR SE ON (PCAD.CODSETOR=SE.CODSETOR)
> LEFT OUTER JOIN CATEGORIA CA ON (...)
> LEFT OUTER JOIN SUBCATEGORIA SC ON (...)
> GROUP BY 1,2,3,4,5
> ORDER BY 1,3,4
>
> ... when passing for a performance
> analysis I do verify that PRODVENDA always appears in red in the
> graph, did I already create indexes ...
> ...does it always continue in red showing researches not
> indexed, does anybody know as could optimize that?

You haven't provided any comparison that would use an index on PROVENDA,
so there's no reason to use a index on it. Since you have both a group
by and an order by, using different values, the index can't be used
navigationally as an alternative to sorting either.


Regards,


Ann