Ver Mensaje Individual
  #5 (permalink)  
Antiguo 10/02/2006, 13:42
Avatar de deadlykyo
deadlykyo
 
Fecha de Ingreso: noviembre-2005
Ubicación: Cbba - Bolivia
Mensajes: 747
Antigüedad: 19 años, 3 meses
Puntos: 5
holas HIa, me parece que la estructura de tablas que maneja no es la mas optima que podria decirse, a medida que vayan creciendo tus tablas haras unas consultas cada vez mas pesadas, seria tal vez una buena idea en pensar otra manera de usar esas tablas que tienes repetidas, ahora otro aspecto sobre tu consulta para ayudar un poco a que consuman menos recursos, por que no haces los joins por medio de INNER JOIN, te ayudara bastante en tus tiempos de ejecucion:

Código:
SELECT
  ig.profile_gender_name_en, count(distinct(ip.uid))
FROM 
  (i_profile ip INNER JOIN i_subprofile_1 ipg1 ON ip.uid = ipg1.uid) INNER JOIN i_profile_gender ig ON ip.profile_gender_id = ig.profile_gender_id),
  (i_profile ip INNER JOIN i_subprofile_2 ipg2 ON ip.uid = ipg2.uid) INNER JOIN i_profile_gender ig ON ip.profile_gender_id = ig.profile_gender_id),
  (i_profile ip INNER JOIN i_subprofile_3 ipg3 ON ip.uid = ipg3.uid) INNER JOIN i_profile_gender ig ON ip.profile_gender_id = ig.profile_gender_id)
WHERE 
  ipg1.photo_status_id <> '0' OR ipg2.photo_status_id <> '0' OR ipg3.photo_status_id <> '0' 
GROUP BY  
  ig.profile_gender_name_en
seria bueno que lo revises, tal vez me equivoque en algo por ahi pero es para darte la idea principal, cya
__________________
"El Conocimiento es de todos, no solo de algunos"