MySQL Forums
Forum List  »  Optimizer & Parser

Re: optimize select query
Posted by: Robert Koziol
Date: January 03, 2011 01:02PM

Hi Rick James,

Thanks a lot for your suggestion.

After studying the examples I have managed to rewrite the query you have mentioned about in the following way:

bo.first_value =
(select max(book1.first_value)
from bookmakers book1
join (select max(insert_date), insert_date, event_id
from bookmakers group by event_id, bookmaker_id)
as bo on bo.insert_date = book1.insert_date and bo.event_id = book1.event_id where book1.event_id = je.id)

So I got rid of one of my correlated max query. Now my query runs much faster on my localhost however it is still very slow on my hosting machine.

Now I guess that I should get rid of the other correlated query. The examples show the way of getting rid of one such a query at a time - I would appreciate further suggestions. If I find anything - I will let you know.

Have a lucky 2011 :)

Regards

Options: ReplyQuote


Subject
Views
Written By
Posted
3112
December 30, 2010 10:59AM
1338
December 31, 2010 08:22PM
Re: optimize select query
1513
January 03, 2011 01:02PM
1449
January 04, 2011 04:07AM
1656
January 06, 2011 09:37PM


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.