MySQL Forums
Forum List  »  Performance

Re: Server just hanging (Copying to tmp table)
Posted by: Thomas Deliduka
Date: December 12, 2005 02:13PM

I don't know if this is a question of query optimization for me anymore. I know that I am the originator of this bug. Now I only found this today so I don't know if my problem is fixed or not. I noticed on one of my servers there was one particular query that was causing all the problems. This one:

select DISTINCT xno_items.itemid, prod_ref, title, short_title, subtitle, promo, author, maincat, inventory, price, strikeprice, retprice, reteprice, saleperc, onsale, clearance, blockp, saledt, xno_items.added, updated, thumb_image, xno_manufacturers.mfg_name
from xno_items
left join xno_item_cat on xno_items.itemid = xno_item_cat.itemid
left join xno_categories on xno_item_cat.catid = xno_categories.catid
left join xno_manufacturers on xno_items.mfgid = xno_manufacturers.mfgid
LEFT JOIN xno_prod_index ON xno_items.itemid = xno_prod_index.itemid
where xno_items.active = 1 AND ((xno_prod_index.word ='thermometer')) AND xno_categories.active = 1 order by xno_prod_index.quan DESC, xno_prod_index.density DESC, xno_items.ordered DESC, xno_items.title;

I change the join order to this:
LEFT JOIN xno_prod_index ON xno_items.itemid = xno_prod_index.itemid
left join xno_item_cat on xno_items.itemid = xno_item_cat.itemid
left join xno_categories on xno_item_cat.catid = xno_categories.catid
left join xno_manufacturers on xno_items.mfgid = xno_manufacturers.mfgid

and instead of 9 seconds to execute the query, it took 0.14 seconds.

So far today the server has been humming along without any hangs problems.

I know enough to be dangerous. Thanks for being patient!

Options: ReplyQuote


Subject
Views
Written By
Posted
8275
December 07, 2006 10:30AM
9655
September 23, 2005 01:56AM
4916
October 05, 2005 04:58AM
6120
October 05, 2005 11:49PM
5382
October 06, 2005 01:34AM
6696
October 06, 2005 04:57PM
Re: Server just hanging (Copying to tmp table)
4755
December 12, 2005 02:13PM
6519
January 21, 2008 10:14AM
5859
January 21, 2008 10:53AM
5321
May 19, 2008 09:41AM
5532
February 05, 2008 10:27AM
6074
March 12, 2008 08:37AM
6133
November 14, 2008 12:31AM


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.