Slow Query
Posted: Wed Aug 01, 2007 4:35 pm
feyd | Please use
None of these tables are huge and none of them have tons of data either. It had a sub-query before within the IN statement, but it's still slow once I put in hard-coded values like above.
Does anyone know of a way to speed this up?
Many thanks!
Philip
feyd | Please use[/syntax]
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
Hello all,
I have a MySQL query that is taking 30 seconds to run.
[syntax="sql"]SELECT orders.order_id, item_codes.stock_code, products.name, order_items.quantity, order_items.final_unit_price
FROM orders, products, order_items, item_codes
WHERE orders.order_id = order_items.order_id
and products.product_id = order_items.item
and order_items.item = item_codes.product_id
and order_items.color = item_codes.color_id
and order_items.size_id = item_codes.size_id
and orders.order_id IN(2742,2743)
order by order_id descDoes anyone know of a way to speed this up?
Many thanks!
Philip
feyd | Please use[/syntax]
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]