I have three database tables which contains large amount of data(6000). I wrote the following query for some operaton which is working fine.
UPDATE productlistprice prl SET prl.value = (
SELECT minprice FROM(
SELECT MIN(prl.value) AS minprice, prv.productmasterid AS masterprid
FROM product pr , productlistprice prl, productvariation prv
WHERE prv.productmasterid = (
SELECT prv.productmasterid FROM productvariation pv
WHERE pv.productid = pr.uuid)
AND prl.productid = pr.uuid AND prl.productid = prv.productid
GROUP BY prv.productmasterid)
WHERE masterprid = (SELECT prv.productmasterid
FROM productvariation prv WHERE prv.productmasterid = prl.productid
GROUP BY prv.productmasterid))
WHERE prl.productid = (
SELECT prv.productmasterid FROM productvariation prv
WHERE prv.productmasterid = prl.productid
GROUP BY prv.productmasterid );
But the performance of this query is bit slow. it is taking 21 seconds to update the records. Where can i improve this query. Any suggestions will be greatly appriciated