Hello Pelle,
Tuesday, February 06, 2001, 3:49:53 PM, you wrote:
PE> Hi,
PE> I think I have a problem with performance.
PE> In my Mysql db I have two tables user (U) and service (S).
PE> I want to read execurl for services registerd on a user ordered by
PE> priority.
PE> I have made a test program in java (JDBC) that sends select like this
PE> I pool connections snd prepared statements so I don't think its a problem
PE> with java.
PE> I tested it agains a single table and then I got 800/selects per second.
PE> SELECT S.execurl FROM S,U WHERE U.userid='ulrika0' AND U.inmethods LIKE
PE> '%INVITE%' AND U.serviceid=S.serviceid ORDER BY U.priority
Classicerror with MySQL : you place condition for link 2 table
(U.serviceid=S.serviceid ) after condition on values. Better way is
join like this :
SELECT S.execurl FROM S inner join U on U.serviceid=S.serviceid WHERE
U.userid='ulrika0' AND U.inmethods LIKE '%INVITE%' ORDER BY U.priority;
And make 2 indexes on tables 1. on S - serviceid,exeurl
2. on U - serviceid,userid,inmethods,priority
Hope it help you
--
Best regards,
Oleg mailto:[EMAIL PROTECTED]
---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php