Re: Table Lock Problem
Posted:
Mon Nov 20, 2017 1:51 pm
by liigi
Hi Matt,
These are some of the slow query from vicidial_list:
Count: 2 Time=411.26s (822s) Lock=0.08s (0s) Rows_sent=0.0 (0), Rows_examined=142063199.5 (284126399), Rows_affected=0.0 (0), cron[cron]@[172.16.18.29]
delete from custom_9638 where lead_id in (select max(lead_id) from vicidial_list where list_id=N and date_format(entry_date, )=date_format(N, )
and status = group by phone_number having count(phone_number)>N)
Count: 5 Time=18.79s (93s) Lock=535.61s (2678s) Rows_sent=3132249.4 (15661247), Rows_examined=3132249.4 (15661247), Rows_affected=0.0 (0), cron[cron]@[172.16.4.53]
select * from asterisk.vicidial_list
Count: 6 Time=16.64s (99s) Lock=0.00s (0s) Rows_sent=3087730.3 (18526382), Rows_examined=3087730.3 (18526382), Rows_affected=0.0 (0), root[root]@localhost
SELECT /*!N SQL_NO_CACHE */ * FROM `vicidial_list`
Count: 8 Time=15.28s (122s) Lock=2.05s (16s) Rows_sent=4389.0 (35112), Rows_examined=3380350.4 (27042803), Rows_affected=0.0 (0), cron[cron]@[172.16.4.129]
SELECT vl.call_date,vl.phone_number,vi.status,vl.user,vu.full_name,vl.campaign_id,vi.vendor_lead_code,vi.source_id,vi.list_id,vi.gmt_offset_now,vi.phone_code,vi.phone_number,vi.title,vi.first_name,vi.middle_initial,vi.last_name,vi.address1,vi.address2,vi.address3,vi.city,vi.state,vi.province,vi.postal_code,vi.country_code,vi.gender,vi.date_of_birth,vi.alt_phone,vi.email,vi.security_phrase,vi.comments,vl.length_in_sec,vl.user_group,vl.alt_dial,vi.rank,vi.owner,vi.lead_id,vl.uniqueid,vi.entry_list_id,UNIX_TIMESTAMP(vl.call_date) from vicidial_users vu,vicidial_log vl,vicidial_list vi where vl.call_date >= and vl.call_date <= and vu.user=vl.user and vi.lead_id=vl.lead_id and vl.campaign_id IN( ) order by vl.call_date desc limit N
Count: 9 Time=8.96s (80s) Lock=3.02s (27s) Rows_sent=1.0 (9), Rows_examined=2266743.7 (20400693), Rows_affected=0.0 (0), cron[cron]@[172.16.4.129]
SELECT count(*) FROM vicidial_list where called_since_last_reset= and status IN( , , , , , , ) and list_id
Count: 12 Time=8.55s (102s) Lock=0.00s (0s) Rows_sent=1410.8 (16930), Rows_examined=3089141.2 (37069694), Rows_affected=0.0 (0), cron[cron]@localhost
select distinct phone_code from vicidial_list
Count: 9 Time=8.34s (75s) Lock=0.66s (5s) Rows_sent=3984.6 (35861), Rows_examined=3362708.3 (30264375), Rows_affected=0.0 (0), cron[cron]@[172.16.4.129]
SELECT vl.call_date,vl.phone_number,vl.status,vl.user,vu.full_name,vl.campaign_id,vi.vendor_lead_code,vi.source_id,vi.list_id,vi.gmt_offset_now,vi.phone_code,vi.phone_number,vi.title,vi.first_name,vi.middle_initial,vi.last_name,vi.address1,vi.address2,vi.address3,vi.city,vi.state,vi.province,vi.postal_code,vi.country_code,vi.gender,vi.date_of_birth,vi.alt_phone,vi.email,vi.security_phrase,vi.comments,vl.length_in_sec,vl.user_group,vl.alt_dial,vi.rank,vi.owner,vi.lead_id,vl.uniqueid,vi.entry_list_id from vicidial_users vu,vicidial_log vl,vicidial_list vi where vl.call_date >= and vl.call_date <= and vu.user=vl.user and vi.lead_id=vl.lead_id and vl.campaign_id IN( ) order by vl.call_date limit N
Count: 506 Time=8.32s (4209s) Lock=0.05s (24s) Rows_sent=0.0 (0), Rows_examined=3383894.0 (1712250364), Rows_affected=0.0 (0), cron[cron]@localhost
SELECT lead_id,list_id,gmt_offset_now,phone_number,state,status,modify_date,user,vendor_lead_code FROM vicidial_list where ( ( (called_since_last_reset IN( , , , , )) and (status= ) and (( (gmt_offset_now= ) and (last_local_call_time < "S") ) or ( (gmt_offset_now= ) and (last_local_call_time < "S") ) ) ) ) and ((list_id IN( ))) and lead_id NOT IN( , , , , , , , ) and ((gmt_offset_now IN( , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ) ) ) order by lead_id asc limit N
Count: 4 Time=7.71s (30s) Lock=1.68s (6s) Rows_sent=1.0 (4), Rows_examined=2177959.0 (8711836), Rows_affected=0.0 (0), cron[cron]@[172.16.4.129]
SELECT count(*) FROM vicidial_list where called_since_last_reset= and status IN( , , , , , , ) and list_id IN( , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ) and (list_id= or ((list_id= and gmt_offset_now NOT and (called_count < N) and list_id NOT IN( )
Count: 7 Time=7.69s (53s) Lock=1.11s (7s) Rows_sent=1.0 (7), Rows_examined=2267768.3 (15874378), Rows_affected=0.0 (0), cron[cron]@[172.16.4.129]
SELECT count(*) FROM vicidial_list where called_since_last_reset= and status IN( , , , , , , ) and list_id I
Count: 1 Time=7.15s (7s) Lock=0.00s (0s) Rows_sent=1.0 (1), Rows_examined=2216237.0 (2216237), Rows_affected=0.0 (0), cron[cron]@[172.16.4.129]
SELECT count(*) FROM vicidial_list where called_since_last_reset= and status IN( , , , , , , ) and list_id IN( , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ) ) ) and (called_count < N) and list_id NOT IN( )
Count: 563 Time=7.15s (4025s) Lock=0.38s (216s) Rows_sent=0.0 (2), Rows_examined=2894039.5 (1629344266), Rows_affected=0.0 (0), cron[cron]@localhost
SELECT lead_id,list_id,gmt_offset_now,phone_number,state,status,modify_date,user,vendor_lead_code FROM vicidial_list where ( ( (called_since_last_reset IN( , , , , )) and (status= ) and (
Please help know what are the recomended size from vicidial_list and vicidial_log in order to avoid slow query, the next month we are going to grow from 200 to 300 agents.
Regards