How much does MySQL need to do?

Am I writing an application and using MySQL to return the difference between two dates in MySQL, if MySQL does this, or should I let PHP handle it?

I also need the sum of all the results that I return, should I return them and add them on the php side, or is there a way to add all the results together on the MySQL server side?

+3
source share
4 answers

It depends on the application in some ways, but in general I would push it to PHP, because usually you create a website for several simultaneous accesses; why invest in a database and possibly have a bottleneck?

+4
source

, . , , , , , , -. -, , - , . -, .

, , , , , . , , , . , , .

+1

. SQL, , , , .

, MySQL :

SELECT id, SUM(price) FROM items GROUP BY id WITH ROLLUP

, id NULL, .

0

, . , , - . , , , , .

0

Source: https://habr.com/ru/post/1708348/


All Articles