Sponsor: VoiceMeUp - Corporate & Wholesale VoIP Services

VoIP Mailing List Archives
Mailing list archives for the VoIP community
 SearchSearch 

[Freeswitch-users] MYSQL Query Performance Related Issue


 
Post new topic   Reply to topic    VoIP Mailing List Archives Forum Index -> freeSWITCH Users
View previous topic :: View next topic  
Author Message
freeswitch-users at li...
Guest





PostPosted: Fri Apr 01, 2022 7:45 am    Post subject: [Freeswitch-users] MYSQL Query Performance Related Issue Reply with quote

------ Start of attached email. Subject: MYSQL Query Performance Related Issue ------
Hi All

I Want to discuss about Mysql query performance related,
We are Using AWS RDS Mysql Database ,AWS RDS CPU Usage is upto 100% when
we perform load test of outbound calls .

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


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

Setup :
we are running this query from Freeswitch using lua script
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

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.

Kindly suggest any other option or method to perform this Query or any
modification required.

Thanks
Devang Dhandhalya

--
*Disclaimer*
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.



*Confidentiality*
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.


*Caution for viruses, malware etc.*
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. 


------ End of attached email ------
_________________________________________________________________________

The FreeSWITCH project is sponsored by SignalWire https://signalwire.com
Enhance your FreeSWITCH install with disruptive priced SMS and PSTN services.
Build your next product on our scalable cloud platform.

Join our online community to chat in real time https://signalwire.community

Professional FreeSWITCH Services
sales@freeswitch.com
https://freeswitch.com

Official FreeSWITCH Sites
https://freeswitch.com/oss
https://freeswitch.org/confluence
https://cluecon.com

FreeSWITCH-users mailing list
FreeSWITCH-users@lists.freeswitch.org
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
https://freeswitch.com
Back to top
christian.berger at fo...
Guest





PostPosted: Fri Apr 01, 2022 8:00 am    Post subject: [Freeswitch-users] MYSQL Query Performance Related Issue Reply with quote

Hi,

Am 01.04.22 um 14:20 schrieb Devang Dhandhalya via FreeSWITCH-users:
Quote:
and rate=(select min(rate) from deckrate where
code=SUBSTRING('12345566878',1,length(code))) limit 1

Here is your problem. That statement will mean that your database will
have to manually go through _all_ entries in the decrate table as it
needs to calculate the SUBSTRING for every entry.

The better solution is to have an index on "code" an a query like...
code in ('12345678', '1234567', '123456'...'12','1')

With such a query the index will be used and it'll be _much_ faster.
Christian Berger




foncloud GmbH & Co KG
Hahlweg 2a
36093 Künzell

Tel: /
Fax: +49 661 968990-99

<![endif]-->
Email: Christian.Berger@foncloud.net
Web: www.foncloud.net



P.S.: Wussten Sie schon?
Unter https://www.foncloud.net/wissen finden Sie zahlreiche Informationen und hilfreiche Artikel rund um unsere Produkte und Services.


Registergericht: Amtsgericht Fulda, Persönlich haftende Gesellschafterin der foncloud GmbH&Co.KG: Global Brain Network GmbH


Geschäftsführer der Global Brain Network GmbH: Peter Krug Sitz der Gesellschaft: Künzell.

Diese E-Mail enthält vertrauliche und/oder rechtlich geschützte Informationen. Wenn Sie nicht der richtige Adressat sind oder diese E-Mail irrtümlich erhalten haben, informieren Sie bitte sofort den Absender und vernichten Sie diese Mail. Das unerlaubte Kopieren sowie die unbefugte Weitergabe dieser Mail ist nicht gestattet.

This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and destroy this e-mail. Any unauthorised copying, disclosure or distribution of the material in this e-mail is strictly forbidden.
Back to top
freeswitch-users at li...
Guest





PostPosted: Fri Apr 01, 2022 9:12 am    Post subject: [Freeswitch-users] MYSQL Query Performance Related Issue Reply with quote

------ Start of attached email. Subject: Re: [Freeswitch-users] MYSQL Query Performance Related Issue ------
Hi Christian

Yes we start using IN operator instead of substring aggregate function

Thank you so much for your Response Smile

Regards
Devang Dhandhalya


On Fri, Apr 1, 2022 at 6:02 PM Christian Berger <
christian.berger@foncloud.net> wrote:

Quote:
Hi,

Am 01.04.22 um 14:20 schrieb Devang Dhandhalya via FreeSWITCH-users:
Quote:
and rate=(select min(rate) from deckrate where
code=SUBSTRING('12345566878',1,length(code))) limit 1

Here is your problem. That statement will mean that your database will
have to manually go through _all_ entries in the decrate table as it
needs to calculate the SUBSTRING for every entry.

The better solution is to have an index on "code" an a query like...
code in ('12345678', '1234567', '123456'...'12','1')

With such a query the index will be used and it'll be _much_ faster.


Christian Berger




foncloud GmbH & Co KG
Hahlweg 2a
36093 Künzell

Tel: /
Fax: +49 661 968990-99

Email: Christian.Berger@foncloud.net
Web: www.foncloud.net


*P.S.: Wussten Sie schon? *

*Unter https://www.foncloud.net/wissen <https://www.foncloud.net/wissen>
finden Sie zahlreiche Informationen und hilfreiche Artikel rund um unsere
Produkte und Services.*



Registergericht: Amtsgericht Fulda, Persönlich haftende Gesellschafterin
der foncloud GmbH&Co.KG: Global Brain Network GmbH
Geschäftsführer der Global Brain Network GmbH: Peter Krug Sitz der
Gesellschaft: Künzell.

Diese E-Mail enthält vertrauliche und/oder rechtlich geschützte
Informationen. Wenn Sie nicht der richtige Adressat sind oder diese E-Mail
irrtümlich erhalten haben, informieren Sie bitte sofort den Absender und
vernichten Sie diese Mail. Das unerlaubte Kopieren sowie die unbefugte
Weitergabe dieser Mail ist nicht gestattet.

This e-mail may contain confidential and/or privileged information. If you
are not the intended recipient (or have received this e-mail in error)
please notify the sender immediately and destroy this e-mail. Any
unauthorised copying, disclosure or distribution of the material in this
e-mail is strictly forbidden.



_________________________________________________________________________

The FreeSWITCH project is sponsored by SignalWire https://signalwire.com
Enhance your FreeSWITCH install with disruptive priced SMS and PSTN
services.
Build your next product on our scalable cloud platform.

Join our online community to chat in real time
https://signalwire.community

Professional FreeSWITCH Services
sales@freeswitch.com
https://freeswitch.com

Official FreeSWITCH Sites
https://freeswitch.com/oss
https://freeswitch.org/confluence
https://cluecon.com

FreeSWITCH-users mailing list
FreeSWITCH-users@lists.freeswitch.org
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
https://freeswitch.com

--
*Disclaimer*
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.



*Confidentiality*
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.


*Caution for viruses, malware etc.*
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. 


------ End of attached email ------
_________________________________________________________________________

The FreeSWITCH project is sponsored by SignalWire https://signalwire.com
Enhance your FreeSWITCH install with disruptive priced SMS and PSTN services.
Build your next product on our scalable cloud platform.

Join our online community to chat in real time https://signalwire.community

Professional FreeSWITCH Services
sales@freeswitch.com
https://freeswitch.com

Official FreeSWITCH Sites
https://freeswitch.com/oss
https://freeswitch.org/confluence
https://cluecon.com

FreeSWITCH-users mailing list
FreeSWITCH-users@lists.freeswitch.org
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
https://freeswitch.com
Back to top
Display posts from previous:   
Post new topic   Reply to topic    VoIP Mailing List Archives Forum Index -> freeSWITCH Users All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group

VoiceMeUp - Corporate & Wholesale VoIP Services