Return to site

GREEN IT Developer 🌍💚: Avoid running SQL queries inside a loop

· greenIT

SQL queries inside a loop ➰ seriously hinder performance 💪, especially if the SQL server(s) are not on the local machine. That is because these servers are designed to handle several selections, insertions, or modifications in one single query or transaction.

Wrongly used, these queries unnecessarily consume CPU power ⚡, RAM 💾 and bandwidth 🌐.

Instead of:

 

write: