MySQL Forums
Forum List  »  Performance

Re: Server just hanging (Copying to tmp table)
Posted by: Jay Pipes
Date: December 14, 2005 11:43PM

You may also want to try putting the joined table's filters in the ON condition of the LEFT JOIN, so that the filter is applied *before* the join, not after:

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_prod_index
ON xno_items.itemid = xno_prod_index.itemid
AND xno_prod_index.word ='thermometer' # Note it moved from WHERE to here...
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
AND xno_categories.active = 1 # Note it moved from WHERE to here...
LEFT JOIN xno_manufacturers
ON xno_items.mfgid = xno_manufacturers.mfgid
WHERE xno_items.active = 1
ORDER BY
xno_prod_index.quan DESC
, xno_prod_index.density DESC
, xno_items.ordered DESC
, xno_items.title;

Jay Pipes
Community Relations Manager, North America, MySQL Inc.

Got Cluster? http://www.mysql.com/cluster
Personal: http://jpipes.com

Options: ReplyQuote


Subject
Views
Written By
Posted
8300
December 07, 2006 10:30AM
9675
September 23, 2005 01:56AM
4936
October 05, 2005 04:58AM
6146
October 05, 2005 11:49PM
5403
October 06, 2005 01:34AM
6719
October 06, 2005 04:57PM
Re: Server just hanging (Copying to tmp table)
4620
December 14, 2005 11:43PM
6543
January 21, 2008 10:14AM
5879
January 21, 2008 10:53AM
5348
May 19, 2008 09:41AM
5552
February 05, 2008 10:27AM
6097
March 12, 2008 08:37AM
6154
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.