[Serusers] Serweb or MySQL bug ?

Jiri Kuthan jiri at iptel.org
Mon Jul 28 11:52:20 CEST 2003

I think the problem is that the sql query, which tries to capture both
calls to canonic username as well as aliases, has poor performance.
The list eventually shows up but the mysql joint construct simply takes
too long. The query should be reshaped into a faster one.


At 08:44 PM 7/25/2003, Juan J. Sierralta P. wrote:
>        I'm accounting for missed calls onto MySQL everything fine. But Serweb
>doesn't show the missed calls so checking on missed_calls.php line 29:
>$q="select distinct t1.from_uri, t1.sip_from, t1.time, t1.sip_status
>from "
>        $config->table_missed_calls." t1, ".$config->table_aliases."
>        " where t1.username='".$auth->auth["uname"].
>        "' OR ('sip:".$auth->auth["uname"]."@".$config->default_domain.
>            "'=t2.contact AND t2.username=t1.username) ".
>        " order by time desc";
>        Is the line that make the actual query to DB so I run the following
>queries on MySQL (v3.23.49):
>mysql> select t1.from_uri,t1.username from missed_calls t1 where
>| from_uri                                | username   |
>| sip:5624108990 at;user=phone | 5624108980 |
>1 row in set (0.00 sec)
>        Fine so far, but if check for the something similar as serweb's query:
>mysql> select t1.from_uri,t1.username from missed_calls t1, aliases t2
>where t1.username='5624108980' OR ('5624108980 at marte'=t2.contact AND
>Empty set (0.01 sec)
>        If I understand correctly the idea of the query is to get that missed
>calls that match the username or an alias, in my case I have not aliases
>defined; but since the query uses OR for aliases part I don't know why
>the query gets an empty set.
>        BTW I'm no SQL fluent :)
>Juanjo sin .sig :(
>Serusers mailing list
>serusers at lists.iptel.org

Jiri Kuthan            http://iptel.org/~jiri/ 

More information about the sr-users mailing list