What is more efficient in your opinion - using SQL functions or fetch data and do the math with PHP? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

What is more efficient in your opinion - using SQL functions or fetch data and do the math with PHP?

5th Jan 2017, 2:53 PM
Radosław Roszkowski
Radosław Roszkowski - avatar
3 Answers
+ 1
In my current project we use stored procedures that contains all DB logic with data structure, joins etc. It is considered to be more productive. In PHP we just call that procedures and get results from DB like API calls
5th Jan 2017, 4:11 PM
Rodion Abdurakhimov
Rodion Abdurakhimov - avatar
+ 1
if you have a complex queries I recommend store them in procedures. This will simplify your PHP code as well. But if you are going to migrate to another DB in the future: maybe it's better use PDO and universal SQL that will run in different DBs identically
5th Jan 2017, 6:25 PM
Rodion Abdurakhimov
Rodion Abdurakhimov - avatar
0
use standard sql statments because if you want develop your project and use another db
5th Jan 2017, 5:42 PM
ASNM
ASNM - avatar