MySQL vs Web Server for data processing

I was wondering if it is faster to process data in MySQL or in a server language such as PHP or Python. I am sure that native functions like ORDER will be faster in MySQL due to indexing, caching, etc., but actually calculate the rank (including links that return multiple records as having the same rank):

SQL example

SELECT TORCH_ID,
    distance AS thisscore,
    (SELECT COUNT(distinct(distance))+1 FROM torch_info WHERE distance > thisscore) AS rank
    FROM torch_info ORDER BY rank

Server

... as opposed to simple execution SELECT TORCH_ID FROM torch_info ORDER BY score DESC, and then determine the rank in PHP on the web server.

+3
source share
6 answers

MySQL, , . , 90% , , ? -/ , , .

+1

, " -", " ".

  • -. . , .
  • , , . SELECT *, -, , x = 3, SELECT * WHERE x = 3
  • , , ..
+2

, . , , mySQL, , PHP .

+1

, . , , , , .

0

, . , torchID ...

, mySQL , .

, , , , - , SQL . . " " .

, , 10 000 , 1000 , , 100 , . , 100 , 10% (9999), 1000 .

.

0

, JDBC- ODBC dsn, 2-3 . ( , odbc dsn )

0

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


All Articles