MySQL Forums
Forum List  »  Performance

Re: Slow performance
Posted by: Aftab Khan
Date: July 25, 2012 02:49AM

If its faster sometimes then it's probably because when you run the same query twice i.e. first time slow but second time fast due to caching.

SELECT mantis_bug_table. * , sadb.business_name AS service_agent_name 
FROM mantis_bug_table 
LEFT JOIN national_sam.asgeodata AS sadb ON mantis_bug_table.service_agent = sadb.rs_id 
ORDER BY mantis_bug_table.last_updated DESC , mantis_bug_table.date_submitted DESC 
LIMIT 100 , 50

You don't need LEFT JOIN, so if you remove join from the above sql, then you would get the same result as with original sql, try:

SELECT 
  mantis_bug_table.*,
  
FROM
  mantis_bug_table 
ORDER BY mantis_bug_table.last_updated DESC,
  mantis_bug_table.date_submitted DESC 
LIMIT 100, 50

So, you probably need INNER JOIN

SELECT 
  mantis_bug_table.*,
  sadb.business_name AS service_agent_name 
FROM
  mantis_bug_table 
  INNER JOIN national_sam.asgeodata AS sadb 
    ON mantis_bug_table.service_agent = sadb.rs_id 
ORDER BY mantis_bug_table.last_updated DESC,
  mantis_bug_table.date_submitted DESC 
LIMIT 100, 50



Edited 1 time(s). Last edit at 07/26/2012 04:02AM by Aftab Khan.

Options: ReplyQuote


Subject
Views
Written By
Posted
2524
July 24, 2012 02:03PM
Re: Slow performance
980
July 25, 2012 02:49AM
1051
July 26, 2012 03:43AM
1038
July 26, 2012 04:05AM
694
July 27, 2012 09:34AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.