MySQL Forums
Forum List  »  Stored Procedures

Looping (cursor) in SP giving performance delays
Posted by: Uma Ram
Date: March 04, 2020 06:30PM

Hello All,

Need your help on this ..

One of the requirement is , we have to populate the best price along with selected product price from list of products.

Ex : If customer selects the particular product (ex:levis jean) among the listed similar proudcts which price is $50; but from listed

products there is another company brand jean was $40 which is best price among all products listed above ..

1. I have to populate best price along with customer selected product price.
2. Along with I have to populate difference amount(ex: 50 - 40 = 10)

Now I need your help for design point of view for getting best performance while writing the StoredProcedure(MySQl)/Relational


I am little new for stored procedures and database; So I have implemented this scenario using cursor(looping) all products prices for

get best price and after that inserted that value into new table(which will have best price, difference amount, proudct #, name..etc

).(from that table web team can pull that value)

but this approach is giving lot of delay ; some times 100s of companies show similar brand , that time looping have to iterate all and

get the best price may taking time.

Can you advise what are the other ways to get these results in better performance.


Options: ReplyQuote

Written By
Looping (cursor) in SP giving performance delays
March 04, 2020 06:30PM

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.