Projekt

Allgemein

Profil

GX-Bug #65261

Von Ulrich Wenk vor mehr als 4 Jahren aktualisiert

E-Mail Seite funktioniert bei sehr vielen E-Mails > 100000 nicht mehr, da hier dann die SQL Befehle extrem inperformant sind. Hier wäre eine Lösung den SQL Befehl aufzuspalten und in mehrere SQL Befehl umzuschreiben. 

 1. Suchen bzw. Filtern 
 2. die IDs aus dem anderen Tabellen raussuchen 
 3. mit Order by sortieren 
 4. nur 20 Einträge mit Limit anzeigen 

 _____________________ 

 E-Mail page does not work with many e-mails > 100000, because the SQL commands are extremely inperformant. Here a solution would be to split the SQL command and rewrite it into several SQL commands. 

 1. search or filter 
 2. select the IDs from the other tables 
 3. sort with Order by 
 4. show only 20 entries with limit 

 SELECT DISTINCT `emails`.* 
 FROM `emails` 
 LEFT JOIN `email_contacts` ON `email_contacts`.`email_id` = `emails`.`email_id` 
 LEFT JOIN `email_attachments` ON `email_attachments`.`email_id` = `emails`.`email_id` 
 WHERE `emails`.`subject` LIKE '%%' ESCAPE '!' 
 OR `emails`.`content_html` LIKE '%%' ESCAPE '!' 
 OR `emails`.`content_plain` LIKE '%%' ESCAPE '!' 
 OR `emails`.`creation_date` LIKE '%%' ESCAPE '!' 
 OR `emails`.`sent_date` LIKE '%%' ESCAPE '!' 
 OR `email_contacts`.`email_address` LIKE '%%' ESCAPE '!' 
 OR `email_contacts`.`contact_name` LIKE '%%' ESCAPE '!' 
 OR `email_attachments`.`path` LIKE '%%' ESCAPE '!' 
 OR `email_attachments`.`name` LIKE '%%' ESCAPE '!' 
 ORDER BY creation_date DESC 
 LIMIT 20

Zurück