7
I have a chart of artisans with about 90,000 records. I created the SQL below to return me the total of artisans in each of the regions that they are registered. Although it works, it is slow, taking more than 30 seconds to return the records.
How can I improve?
SELECT
coordenacao.descricao AS nome,
COUNT(artesao.codigo) AS qtde
FROM
municipio, artesao, coordenacaomunicipios, coordenacao
WHERE
artesao.codMunicipio = municipio.codigo AND
coordenacaomunicipios.codMunicipio = municipio.codigo AND
coordenacaomunicipios.codCoordenacao = coordenacao.codigo AND
artesao.codStatus = 1
GROUP BY
coordenacao.descricao
ORDER BY
coordenacao.codigo
Did any of the solutions work out below ?
– Raphael Prado de Oliveira