Jump to content

Query takes ages


c_pattle

Recommended Posts

I have the following query that takes 69 seconds, which I reckon is going to be a tad bit too slow to use on a public facing website  :P .  I was wondering if anyone knows how I can speed up the query. 

 

SELECT product_data.*, products.supplier_ref, product_pricing.sales_price_inc_vat, products.type_id, MATCH(product_data.product_name) AGAINST ("Metacam") AS score FROM product_data, products, product_pricing WHERE products.type_id = 1 AND product_data.product_id=products.product_id AND product_data.product_id=product_pricing.product_id  AND products.type_id = 1 ORDER BY score DESC LIMIT 20

 

Let me know if you want me to put the table structures on here but they are quite big!

 

Thanks

Link to comment
Share on other sites

Thanks, this was the results

 

id select_type table type possible_keys key key_len ref rows Extra

1 SIMPLE product_data ALL NULL NULL NULL NULL 12432 Using temporary; Using filesort

1 SIMPLE product_pricing ALL NULL NULL NULL NULL 5558 Using where

1 SIMPLE products eq_ref PRIMARY PRIMARY 4 animed.product_data.product_id 1 Using where

 

So I guess I need to add some indexes?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.