[Freeswitch-users] mod_lcr and indexes

Marcelo Sosa - LST listas at askterisk.com
Thu Sep 17 19:24:05 PDT 2009


Hello all,

This is my first message on the list, i´m pretty new to FS.
I was playing a bit with mod_lcr and found that the sql query for fetching the lowest rate can be changed to a better use of indexes, at least on mysql. Anyone can do some test using other DBs?

The change i've made was simple, the original query was something about "... AND digits IN (12345, 1234, 123, 12, 1) ..." and using EXPLAIN i saw that it was using carrier_id as key for the biggest table and not digits. I've changed the code so the query is " AND (digits='12345' OR digits='1234' OR digits='123' OR digits='12' OR digits='1') " and mysql uses the index from the digits row, reducing the returned resultset of the subquery from all the digits from a carrier to the number of "OR" in the query (in my case, from 19850+ to 14).

Anyone think that this may be a nice change? or it is just a bad use of indexes by mysql?

Regards,
Marcelo Sosa
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20090917/7a8e601c/attachment-0002.html 


More information about the FreeSWITCH-users mailing list