.NET/SQL Optimization: SQL-side v code-side

Status
You're currently viewing only svdsinner's posts. Click here to go back to viewing the entire thread.

svdsinner

Ars Legatus Legionis
15,152
Subscriptor
Question: You are comparing two ways to compute something expensive:
  1. Computing on the SQL server and getting the answer via SqlClient
  2. SQL data brought into memory via SqlClient and the compute done in .NET code.
Beyond execution time, how do you factor in that #2 will use more memory and causes more pressure on garbage collection? (The wonderful aspect of .NET that when GC kicks in, your app just hangs for a bit while it does GC and you can't control when that happens)

Example: if #1 finishes in 2 seconds and #2 finishes in .4 seconds but sends 1.6MB into GC each run, how do you decide whether that extra 1.6MB of GC pressure is worth it for the faster execution time?

Assume: this expensive calculating is happening 10-100 times/minute and the server has plenty of memory and cores to handle the load.
Assume: this expensive calculation is faster to compute with .NET than with TSQL. (Otherwise this is all moot)
 
Status
You're currently viewing only svdsinner's posts. Click here to go back to viewing the entire thread.