<div dir="ltr"><span style="color:rgb(51,51,51);font-family:"Open Sans",Arial,Helvetica,sans-serif;font-size:13.8px">Hi All</span><br style="box-sizing:inherit;color:rgb(51,51,51);font-family:"Open Sans",Arial,Helvetica,sans-serif;font-size:13.8px"><br style="box-sizing:inherit;color:rgb(51,51,51);font-family:"Open Sans",Arial,Helvetica,sans-serif;font-size:13.8px"><span style="color:rgb(51,51,51);font-family:"Open Sans",Arial,Helvetica,sans-serif;font-size:13.8px">I Want to discuss about Mysql query performance related,</span><br style="box-sizing:inherit;color:rgb(51,51,51);font-family:"Open Sans",Arial,Helvetica,sans-serif;font-size:13.8px"><span style="color:rgb(51,51,51);font-family:"Open Sans",Arial,Helvetica,sans-serif;font-size:13.8px">We are Using AWS RDS Mysql Database ,AWS RDS CPU Usage is upto 100% when we perform load test of outbound calls .</span><br style="box-sizing:inherit;color:rgb(51,51,51);font-family:"Open Sans",Arial,Helvetica,sans-serif;font-size:13.8px"><br style="box-sizing:inherit;color:rgb(51,51,51);font-family:"Open Sans",Arial,Helvetica,sans-serif;font-size:13.8px"><span style="color:rgb(51,51,51);font-family:"Open Sans",Arial,Helvetica,sans-serif;font-size:13.8px">Problem : Actually we are using This Mysql Query to get price and rateid with use of Dialled Number with most length match in table using Substring aggregate functions and minimum rate for same Dialled Number with Substring fucntion in Deckrate Table</span><br style="box-sizing:inherit;color:rgb(51,51,51);font-family:"Open Sans",Arial,Helvetica,sans-serif;font-size:13.8px"><br style="box-sizing:inherit;color:rgb(51,51,51);font-family:"Open Sans",Arial,Helvetica,sans-serif;font-size:13.8px"><br style="box-sizing:inherit;color:rgb(51,51,51);font-family:"Open Sans",Arial,Helvetica,sans-serif;font-size:13.8px"><span style="color:rgb(51,51,51);font-family:"Open Sans",Arial,Helvetica,sans-serif;font-size:13.8px">Query : select deckrate.rate as carrierPrice,deckrate.rateid from deckrate where code=SUBSTRING('12345566878',1,length(deckrate.code)) and rate=(select min(rate) from deckrate where code=SUBSTRING('12345566878',1,length(code))) limit 1</span><br style="box-sizing:inherit;color:rgb(51,51,51);font-family:"Open Sans",Arial,Helvetica,sans-serif;font-size:13.8px"><br style="box-sizing:inherit;color:rgb(51,51,51);font-family:"Open Sans",Arial,Helvetica,sans-serif;font-size:13.8px"><span style="color:rgb(51,51,51);font-family:"Open Sans",Arial,Helvetica,sans-serif;font-size:13.8px">Setup :</span><br style="box-sizing:inherit;color:rgb(51,51,51);font-family:"Open Sans",Arial,Helvetica,sans-serif;font-size:13.8px"><span style="color:rgb(51,51,51);font-family:"Open Sans",Arial,Helvetica,sans-serif;font-size:13.8px">we are running this query from Freeswitch using lua script</span><br style="box-sizing:inherit;color:rgb(51,51,51);font-family:"Open Sans",Arial,Helvetica,sans-serif;font-size:13.8px"><span style="color:rgb(51,51,51);font-family:"Open Sans",Arial,Helvetica,sans-serif;font-size:13.8px">when we perform load test calls at that time this query Execute for Every Calls and AWS RDS CPU usage gradually increasing and its upto 100% of CPU usage</span><br style="box-sizing:inherit;color:rgb(51,51,51);font-family:"Open Sans",Arial,Helvetica,sans-serif;font-size:13.8px"><br style="box-sizing:inherit;color:rgb(51,51,51);font-family:"Open Sans",Arial,Helvetica,sans-serif;font-size:13.8px"><span style="color:rgb(51,51,51);font-family:"Open Sans",Arial,Helvetica,sans-serif;font-size:13.8px">we also try with Store Procedure method to decrease query execution time , when we run load test with store procedure after that also getting high cpu usage , actually what we found this substring going to check all 0.5M record in table and find most number of length match with dialled number so i think that aggregate function takes time , Approx 2000 Queries will get executed simultaneously as per call flow.</span><br style="box-sizing:inherit;color:rgb(51,51,51);font-family:"Open Sans",Arial,Helvetica,sans-serif;font-size:13.8px"><br style="box-sizing:inherit;color:rgb(51,51,51);font-family:"Open Sans",Arial,Helvetica,sans-serif;font-size:13.8px"><span style="color:rgb(51,51,51);font-family:"Open Sans",Arial,Helvetica,sans-serif;font-size:13.8px">Kindly suggest any other option or method to perform this Query or any modification required.</span><br style="box-sizing:inherit;color:rgb(51,51,51);font-family:"Open Sans",Arial,Helvetica,sans-serif;font-size:13.8px"><br style="box-sizing:inherit;color:rgb(51,51,51);font-family:"Open Sans",Arial,Helvetica,sans-serif;font-size:13.8px"><span style="color:rgb(51,51,51);font-family:"Open Sans",Arial,Helvetica,sans-serif;font-size:13.8px">Thanks</span><br style="box-sizing:inherit;color:rgb(51,51,51);font-family:"Open Sans",Arial,Helvetica,sans-serif;font-size:13.8px"><span style="color:rgb(51,51,51);font-family:"Open Sans",Arial,Helvetica,sans-serif;font-size:13.8px">Devang Dhandhalya</span><br></div>
<br>
<div><font face="Arial" size="2" style="background-color:white" color="#808080"><b>Disclaimer</b></font></div><div><div><span style="background-color:white;color:rgb(128,128,128);font-family:Arial;font-size:small">In addition to generic Disclaimer which you have agreed on our website, any views or opinions presented in this email are solely those of the originator and do not necessarily represent those of the Company or its sister concerns. Any liability (in negligence, contract or otherwise) arising from any third party taking any action, or refraining from taking any action on the basis of any of the information contained in this email is hereby excluded.</span></div></div><div><span style="background-color:white;color:rgb(128,128,128);font-family:Arial;font-size:small"><br></span></div><div><font face="Arial" size="2" style="background-color:white" color="#808080"><b>Confidentiality</b></font></div><div><font face="Arial" size="2" style="background-color:white" color="#808080">This communication (including any attachment/s) is intended only for the use of the addressee(s) and contains information that is PRIVILEGED AND CONFIDENTIAL. Unauthorized reading, dissemination, distribution, or copying of this communication is prohibited. Please inform originator if you have received it in error.</font></div><div><font face="Arial" size="2" style="background-color:white" color="#808080"><br></font></div><div><span style="background-color:white;color:rgb(128,128,128);font-family:Arial;font-size:small"><b>Caution for viruses, malware etc.</b></span></div><div><font face="Arial" size="2" style="background-color:white" color="#808080">This communication, including any attachments, may not be free of viruses, trojans, similar or new contaminants/malware, interceptions or interference, and may not be compatible with your systems. You shall carry out virus/malware scanning on your own before opening any attachment to this e-mail. The sender of this e-mail and Company including its sister concerns shall not be liable for any damage that may incur to you as a result of viruses, incompleteness of this message, a delay in receipt of this message or any other computer problems. </font></div>