Mysql with index [closed]

Posted on

Question :

I have this following sentence:

SELECT Day(C.DataCadastro) AS Dia, 
       Month(C.DataCadastro) AS Mes, 
       Year(C.DataCadastro) AS Ano, 
       COUNT(I.Plano) AS Total 
FROM clientes AS C 
   JOIN clube_infoclientes AS I ON C.CodUsuario = I.ClienteID 
WHERE ((I.Plano = 1) AND (C.Ativo = 1)) 
GROUP BY Mes 
ORDER BY Dia, Mes, Ano

The name of index is: Plan. sentence of creating is
CREATE INDEX Plan ON clube_infoclientes (Plano(2));

But I can’t use INDEX here..
My question is how I do implement INDEX on the select above

Answer :

my problem’s it:

I was using the indexes with two columns that are not important to me!
I Resolve using indexes on the following columns: C.CodUsuario = I.ClienteID

Thanks to all! ;D

Leave a Reply

Your email address will not be published. Required fields are marked *