Waynn Lue wrote: > Out of curiosity, is it generally faster to do a sub query or do it in > code for something like this. > > Schema of Settings table, where the PK is (ApplicationId, SettingId): > ApplicationId, SettingId, SettingValue > > Select SettingValue from Settings where SettingId = 10 and > ApplicationId IN (select ApplicationId from Settings where SettingId = > 22 and SettingValue = "1"); > > The other solution is to do the two queries separately then do the > filtering in code. > > What's generally faster? > > Waynn >
there is no easy answer. subqueries with constants are fast in mysql without is is better to use a join. complex queries involving several tables with perhaps a lot foreign keys tend to be very slow. using "join" from coreutils can improve things dramaticly. re, wh -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]