MySQL Forums
Forum List  »  Newbie

Query Slowness
Posted by: Jeremy Smith
Date: July 10, 2012 02:39AM

Hi there I have the following query I am running to get more information from multiple tables on my database of products:

SELECT
category AS Manufacturer,
brand.displayvalue AS brand,
productcode AS SKU,
descr AS Short_Description,
fulldescr AS Long_Description,
product_type.displayvalue AS Prioduct_Type,
colour.displayvalue AS Colour,
printer_model.displayvalue AS Printer_Model

FROM xcart_tmp_products

LEFT JOIN product ON xcart_tmp_products.productcode LIKE product.mfgpartno
LEFT JOIN productattribute brand ON product.productid = brand.productid AND brand.attributeid = '33113319'
LEFT JOIN productattribute product_type ON product.productid = product_type.productid AND product_type.attributeid = '331100'
LEFT JOIN productattribute colour ON product.productid = colour.productid AND colour.attributeid = '331100'
LEFT JOIN productattribute printer_model ON product.productid = printer_model.productid AND printer_model.attributeid = '331100'

WHERE forsale LIKE 'Y'

The problem I am having is the above is taking far too long is there anyway of speeding this up and thus improving my own ability within SQL?

I put the LEFT JOINS in with specifying the attributeid since I wanted the results to be in the same line as each row so each row showed more data than what was on xcart_tmp_products table you see.

I was just wondering and thanks for any help in advance,
Jeremy.



Edited 1 time(s). Last edit at 07/10/2012 02:40AM by Jeremy Smith.

Options: ReplyQuote


Subject
Written By
Posted
Query Slowness
July 10, 2012 02:39AM
July 10, 2012 06:43AM
July 10, 2012 06:55AM
July 12, 2012 06:06AM
July 10, 2012 10:16AM


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.