Searching for a lead by name crashes Database
Posted: Fri Aug 01, 2014 3:27 pm
Ok so i have been having a problem where (at first seemed for no apparent reason) the dialer would lock up and calls would stop and agents would not be able to do anything in Vicidial. Turns out that a MySQL query would hang or at least take a really long time to finish which would cause other queries to be on hold etc... causing the problems as described above. So after going through the slow query logs and find some offending slow queries and tracking them down to where they were called from, it turns our that it is from the admin_search_lead.php page when using the option to search for a lead by name (first or last or both), but does not happen when a lead is searched by phone number here is an example query;
The vicidial_list table is about 9 million records, i copied and pasted the query in phpmyadmin to confirm the query locks up the database and it in fact does. So what i also found is that it seems to lock up when its "State" ( as observed in mtop) is "sending".
Lastly, purging or pruning the list table at this point is not an option. Any thoughts are greatly appreciated
- Code: Select all
# Time: 140801 13:13:36
# User@Host: cron[cron] @ localhost []
# Thread_id: 711268 Schema: asterisk QC_hit: No
# Query_time: 35.627407 Lock_time: 0.000116 Rows_sent: 544 Rows_examined: 7314300
SET timestamp=1406916816;
SELECT lead_id,entry_date,modify_date,status,user,vendor_lead_code,source_id,list_id,gmt_offset_now,called_since_last_reset,phone_code,phone_number,title,first_name,middle_initial,last_name,address1,address2,address3,city,state,province,postal_code,country_code,gender,date_of_birth,alt_phone,email,security_phrase,comments,called_count,last_local_call_time,rank,owner from vicidial_list where last_name='STINSON' order by modify_date desc limit 1000;
The vicidial_list table is about 9 million records, i copied and pasted the query in phpmyadmin to confirm the query locks up the database and it in fact does. So what i also found is that it seems to lock up when its "State" ( as observed in mtop) is "sending".
Lastly, purging or pruning the list table at this point is not an option. Any thoughts are greatly appreciated