How can i search records in a large table efficiently?
I have a table(product) with 5.4 million recods. If i'm using below query
to get result but it's working very slow. Is there a more efficient
approach?
SELECT sd.imageid, sd.licencetype, sd.imgcollection, sd.orientation,
sd.pname, sd.pcaption, sd.ptype
FROM (SELECT imageid
FROM product
WHERE productkeyword IN (SELECT primary_kwd
FROM searchkwdmgmt
WHERE allkwd IN ( 'IPhone' ))
GROUP BY imageid
HAVING Count(*) = 1
LIMIT 0, 31) q
JOIN searchdetails sd
ON sd.imageid = q.imageid
No comments:
Post a Comment