MySQL Forums
Forum List  »  PHP

My Query is too slow
Posted by: Solid Snake
Date: February 24, 2010 01:11AM

Hello everyone, I am makeing some kind of product list website and have 2 tables:

products and table_dat... first table is products list, second is specifications of products. Now i would like to get products with selected specifications.

There is example. And it works, but here is problem... this query is too slow. (6 seconds)

Is there any other way to get same results in less time?


SELECT products.id, products.name, products.name_plus, products.name_cat, products.picture, products.price, products.old_price
FROM products
WHERE products.category = '150'
AND products.id
IN (
SELECT table_dat.article_id
FROM table_dat
WHERE (
table_dat.value LIKE 'on|-|%|-|%|-|%|-||-||-||-||-||-|'
)
AND table_dat.cell_id = '62=00'
)
AND products.id
IN (
SELECT table_dat.article_id
FROM table_dat
WHERE (
table_dat.value LIKE '|-||-|on|-||-||-||-||-||-||-|%'
)
AND table_dat.cell_id = '48=00'
)
AND products.id
IN (

SELECT table_dat.article_id
FROM table_dat
WHERE (
table_dat.value LIKE '|-|%|-|%|-|%|-|%|-|%|-|%|-|%|-|on%'
)
AND table_dat.cell_id = '54=00'
)
ORDER BY products.id DESC
LIMIT 0 , 30

Options: ReplyQuote


Subject
Written By
Posted
My Query is too slow
February 24, 2010 01:11AM
February 25, 2010 10:15AM


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.