|
|
|
|
|
by crazygringo
2315 days ago
|
|
I don't think I've ever seen performance improvements from taking logic in a complex SQL query and re-implementing it at the application layer. The bottleneck with databases is virtually never calculations on results (CPU), it's disk access and network latency and bandwidth. And generally, if you do have crazy complex CPU-bound calculations you need to do on data (e.g. scientific stuff)... SQL doesn't provide the necessary functions/control anyways, so the database isn't even an option for that. The only issue I can imagine you might have run into at some point is complex queries badly written (e.g. recursive subqueries without indices) that you could speed up with application logic -- but then the solution is to optimize the query. |
|
I/O is generally just about the slowest thing a computer can do. So, in general, the more you can reduce the data before sending it across the network, the better. And, heck, a well-crafted SQL query can often save you having to even read large chunks of data off of the disk in the first place, let alone pipe it across the network.