Ver Mensaje Individual
  #7 (permalink)  
Antiguo 09/06/2011, 10:37
Avatar de xxxivanxxx
xxxivanxxx
 
Fecha de Ingreso: julio-2010
Ubicación: /home
Mensajes: 114
Antigüedad: 13 años, 8 meses
Puntos: 21
Respuesta: mi Consultaa, muy lenta

gracias por responder, pero entonces que puedo usar en vez de LIKE y ORDER BY, buenoo o siempre va a demorar y consumir CPU por el numero de registros, aqui te dejo la estructura de las tablas, si me puedes ayudar es que no entiendo mucho sobre lo que escribiste,

tabla canciones: 92034 registros!
Código MySQL:
Ver original
  1. CREATE TABLE `canciones` (
  2.  `id_cancion` int(11) NOT NULL DEFAULT '0',
  3.  `id_disco` int(4) DEFAULT NULL,
  4.  `id_artista` int(6) NOT NULL DEFAULT '0',
  5.  `cancion` varchar(100) NOT NULL,
  6.  `slink` varchar(150) NOT NULL,
  7.  `id_file` char(38) NOT NULL,
  8.  `play` int(6) NOT NULL DEFAULT '0',
  9.  `rating` int(6) NOT NULL DEFAULT '0',
  10.  PRIMARY KEY (`id_cancion`)
  11. ) ENGINE=MyISAM DEFAULT CHARSET=latin1

tabla artistas:
Código MySQL:
Ver original
  1. CREATE TABLE `artistas` (
  2.  `id_artista` int(6) NOT NULL DEFAULT '0',
  3.  `id_genero` int(6) NOT NULL DEFAULT '0',
  4.  `artista` varchar(60) NOT NULL,
  5.  `alink` varchar(100) NOT NULL,
  6.  `views` int(6) NOT NULL DEFAULT '0',
  7.  `rating` int(6) NOT NULL DEFAULT '0',
  8.  `ntemas` int(3) NOT NULL DEFAULT '0',
  9.  PRIMARY KEY (`id_artista`)
  10. ) ENGINE=MyISAM DEFAULT CHARSET=latin1

tabla generos:
Código MySQL:
Ver original
  1. CREATE TABLE `generos` (
  2.  `id_genero` int(6) NOT NULL AUTO_INCREMENT,
  3.  `genero` varchar(60) NOT NULL,
  4.  `glink` varchar(60) NOT NULL,
  5.  PRIMARY KEY (`id_genero`)

y la consulta en cuestion que me demora mucho:

Código MySQL:
Ver original
  1. SELECT a.artista,a.alink,c.cancion,c.slink,c.id_file,g.gl ink FROM artistas a, canciones c, generos g WHERE c.id_artista = a.id_artista AND a.id_genero = g.id_genero AND g.glink LIKE 'generodeprueba' ORDER BY c.rating DESC LIMIT 0,124

si el problema es la estructura, podrias ayudarme en como puedo hacer la estructura para no tener problemas con ese tipo de consultas, :)

Última edición por xxxivanxxx; 09/06/2011 a las 10:44