<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.6000.20996" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial size=2>Hello all,</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>This is my first message on the list, i´m pretty
new to FS.</FONT></DIV>
<DIV><FONT face=Arial size=2>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?</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>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).</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Anyone think that this may be a nice change? or it
is just a bad use of indexes by mysql?</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Regards,</FONT></DIV>
<DIV><FONT face=Arial size=2>Marcelo Sosa</FONT></DIV></BODY></HTML>