Ver Mensaje Individual
  #2 (permalink)  
Antiguo 06/01/2010, 10:51
Avatar de huesos52
huesos52
Colaborador
 
Fecha de Ingreso: febrero-2009
Ubicación: Manizales - Colombia
Mensajes: 5.980
Antigüedad: 16 años, 1 mes
Puntos: 360
Respuesta: Como Obtimizar esta Consulta?

No utilices el *.

solo llama los campos que requieras. En tu caso ip_publica.

Prueba así y dinos si mejora

Código SQL:
Ver original
  1. SELECT T1.ip_publica AS ip, T2.*, T2.country_name AS pais, COUNT(T2.country_name) AS total FROM (SELECT ip_publica FROM stat_user GROUP BY ip_publica) AS T1 LEFT JOIN stat_country AS T2 ON INET_ATON(T1.ip_publica)>=T2.IP_FROM AND INET_ATON(T1.ip_publica)<=T2.IP_TO GROUP BY pais ORDER BY total DESC LIMIT 0,10

o así

Código SQL:
Ver original
  1. SELECT T1.ip_publica AS ip, T2.*, T2.country_name AS pais, COUNT(T2.country_name) AS total FROM (SELECT DISTINCT ip_publica FROM stat_user) AS T1 LEFT JOIN stat_country AS T2 ON INET_ATON(T1.ip_publica)>=T2.IP_FROM AND INET_ATON(T1.ip_publica)<=T2.IP_TO GROUP BY pais ORDER BY total DESC LIMIT 0,10
__________________
Without data, You are another person with an opinion.
W. Edwads Deming