MySQL Forums
Forum List  »  Spanish

Re: Optimizacion de tablas o optimizacion de consultas
Posted by: Jesús Uzcanga
Date: March 19, 2013 08:00AM

Reynier.

Para el problema de subir los datos del excel a la BD yo haría lo siguiente.

Crear una nueva tabla tbl_temporal y subir el excel completo en esta tabla. Luego teniendo todo en mysql es más eficiente tratar los datos en tablas que en un array y consume menos recursos.

Aquí tendrías varias opciones, a saber:

Hacer un DELETE a la tabla tbl_temporal con JOIN hacia las 2 tablas de comparación que limpie los datos temporales de datos repetidos.

Hacer un INSERT INTO SELECT * FROM tbl_temporal INNER JOIN .... Y aqui metes las tablas de comparación haciendo con los JOIN, el WHERE y GROUP BY que solo inserte datos que no esten repetidos.
---------------------------------------------------------------------------

El segundo problema no lo entendí... Lo de 1000 en 1000.

---------------------------------------------------------------------------

NOTA: Recuerda que este foro no es de PHP, es solo de MYSQL, por favor no hacer referencia a funciones propias de lenguajes que no sean SQL (PHPExcel, in_array, array_merge, ETC).

___________________________
Ing. Jesús Alfredo Uzcanga
Twitter: @JesusUzcanga

We learn the 20% of what we HEAR,
the 50% of what we SEE,
the 80% of what we DO and
the 95% of what we TEACH.

____________________________________________________________
https://www.linkedin.com/in/jauzcanga/

Options: ReplyQuote




Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.