RE: [PHP-ES] [OFF_TOPIC]Rendimiento de MySQL

From: Date: Wed, 05 Dec 2001 09:12:19 +0000
Subject: RE: [PHP-ES] [OFF_TOPIC]Rendimiento de MySQL
References: 1 2  Groups: php.general.es 
Request: Send a blank email to general-es+get-16396@lists.php.net to get a copy of this message
Hola a todos...... Ya, pero luego tengo que hacer otras consultas que si utilizarían esos indices. Por eso los he creado. ----- Original Message ----- From: Carmona van Kempen, Pablo <pablocarmona@interkonet.com> To: <lista@phpes.com> Sent: Tuesday, December 04, 2001 10:14 PM Subject: Re: [PHP-ES] [OFF_TOPIC]Rendimiento de MySQL > La consulta que haces me da la sensación que sólo usa el índice > 'idx_tipo', los otros no le sirven para nada, y puede que estén > cargando el sistema, > > es sobre las tablas: > materiaslegislaciones > tiposlegislaciones > emisoreslegislaciones > que se están haciendo las búsquedas por el campo 'id' > > > José Antonio González Prieto wrote: > > > > Hola a todos..... > > > > Me ocurre lo siguiente . > > > > En MySQL Creo las siguientes tablas : > > **************************************************************** > > CREATE TABLE legislaciones ( > > id int(11) NOT NULL auto_increment, > > idestadoweb int(11) DEFAULT '1' NOT NULL, > > fechapub date DEFAULT '0000-00-00' NOT NULL, > > idemisor int(11) DEFAULT '0' NOT NULL, > > idmateria int(11) DEFAULT '0' NOT NULL, > > idtipo int(11) DEFAULT '0' NOT NULL, > > numeroboletin int(11) DEFAULT '0' NOT NULL, > > titulo tinytext DEFAULT '' NOT NULL, > > ficherolegislacion tinytext DEFAULT '' NOT NULL, > > urls text, > > observaciones text, > > enviada int(1) DEFAULT '0' NOT NULL, > > iduser int(11) DEFAULT '0' NOT NULL, > > fecha datetime DEFAULT '0000-00-00 00:00:00' NOT NULL, > > iduserin int(11) DEFAULT '0' NOT NULL, > > fechain datetime DEFAULT '0000-00-00 00:00:00' NOT NULL, > > PRIMARY KEY (id), > > KEY idx_estadoweb (idestadoweb), > > KEY idx_titulo (titulo(50)), > > KEY idx_observaciones (observaciones(50)), > > KEY idx_tipo (idtipo), > > KEY idx_emisor (idemisor), > > KEY idx_materia (idmateria) > > ); > > > > # > > # Table structure for table 'legislacionesant' > > # > > > > CREATE TABLE legislacionesant ( > > ( > > id int(11) NOT NULL auto_increment, > > idestadoweb int(11) DEFAULT '1' NOT NULL, > > fechapub date DEFAULT '0000-00-00' NOT NULL, > > idemisor int(11) DEFAULT '0' NOT NULL, > > idmateria int(11) DEFAULT '0' NOT NULL, > > idtipo int(11) DEFAULT '0' NOT NULL, > > numeroboletin int(11) DEFAULT '0' NOT NULL, > > titulo tinytext DEFAULT '' NOT NULL, > > ficherolegislacion tinytext DEFAULT '' NOT NULL, > > urls text, > > observaciones text, > > enviada int(1) DEFAULT '0' NOT NULL, > > iduser int(11) DEFAULT '0' NOT NULL, > > fecha datetime DEFAULT '0000-00-00 00:00:00' NOT NULL, > > iduserin int(11) DEFAULT '0' NOT NULL, > > fechain datetime DEFAULT '0000-00-00 00:00:00' NOT NULL, > > PRIMARY KEY (id) > > ); > > > > **************************************************************** > > , que son identicas excepto en la creación de indices. > > > > La siguiente sentencia SQL (donde las tablas de tipos,materias y emisores de > > legislaciones son comunes): > > > > select > > legislaciones.id,legislaciones.titulo,legislaciones.fechapub,tiposlegislacio > > nes.tipo,materiaslegislaciones.clave > > from legislaciones,materiaslegislaciones,tiposlegislaciones > > ,emisoreslegislaciones > > where (legislaciones.idtipo=2) > > and (legislaciones.idemisor=emisoreslegislaciones.id) > > and (legislaciones.idmateria=materiaslegislaciones.id) > > and (legislaciones.idtipo= tiposlegislaciones.id) > > order by legislaciones.fechapub desc limit 0,40 > > > > aplicada a las dos tablas me da como resultado que la ejecución sobre la 2ª > > tabla tarda 0.15 seg. y sobre la 1ª tabla tarda 0.68 seg. > > > > ¿Que estoy haciendo mal ( pues en teoria deberia ir más rápido la 1ª > > consulta al utilizar indices)? > > > > Gracias y un saludo a todos ...... y a ver si hay menos polémicas > > "dialecticas" en la lista ..... > > > > --------------------------------------------------------------------- > > Archivo On-line: http://www.phpes.com/ > > Manual PHP en español: http://www.php.net/manual/es/ > > Para dar de baja la suscripción, mande un mensaje a: > > lista-unsubscribe@phpes.com > > -- > Pablo Carmona van Kempen > Interkonet Publishers, s.l. > Atenas 22 Bajos - 08006 - Barcelona SPAIN > http://www.interkonet.com/ > > --------------------------------------------------------------------- > Archivo On-line: http://www.phpes.com/ > Manual PHP en español: http://www.php.net/manual/es/ > Para dar de baja la suscripción, mande un mensaje a: > lista-unsubscribe@phpes.com >

« previous php.general.es (#16396) next »