17/11/2011, 11:10
|
| | | Fecha de Ingreso: enero-2005 Ubicación: aquí
Mensajes: 380
Antigüedad: 19 años, 9 meses Puntos: 0 | |
Query extremadamente lenta Hola que tal,
Tengo un query que esta demasiado lento, apenas el fin de semana pasado empezamos a notar esto, ya tenemos algo de tiempo con la tabla y el algo grande.
De que forma puedo hacerlo funcionar más rápido?
Este es el query:
SELECT DISTINCT account.first_name AS account_first_name, account.last_name AS account_last_name, account.email AS account_email, flag.*, EXISTS (SELECT * FROM flag_x_trait WHERE flag.id = flag_x_trait.flag_id) AS is_completed FROM account LEFT JOIN flag ON (account.id = flag.account_id) LEFT JOIN account AS buyer ON (buyer.id = flag.buyer_id) WHERE ( LOWER(account.email) LIKE LOWER('%ayala%') OR LOWER(account.first_name) LIKE LOWER('%ayala%') OR LOWER(account.last_name) LIKE LOWER('%ayala%') OR LOWER(buyer.email) LIKE LOWER('%ayala%') OR LOWER(buyer.first_name) LIKE LOWER('%ayala%') OR LOWER(buyer.last_name) LIKE LOWER('%ayala%') OR LOWER(flag.access_code) LIKE LOWER('%ayala%') OR LOWER(flag.first_name) LIKE LOWER('%ayala%') OR LOWER(flag.last_name) LIKE LOWER('%ayala%') OR LOWER(flag.share_email) LIKE LOWER('%ayala%') ) ORDER BY account_id DESC ;
Espero que alguien me pueda orientar
Saludos |