Hi, Am 01.04.22 um 14:20 schrieb Devang Dhandhalya via FreeSWITCH-users:
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 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 GmbHGeschä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.