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

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

Apteris

Ars Tribunus Angusticlavius
9,589
Subscriptor
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?
By thinking about what is making your stakeholders the most unhappy at the moment, and improving on that particular pain point.

I read your question as "#1 is a bit slower, but #2 is a bit more annoying because of the GC, which should I choose?" We can't answer that, we don't have the context you have. Perhaps I'm misunderstanding your question; let me know.

You may find this relevant: Implementing SLOs -- chapter 2 of the Google SRE book.
 

Apteris

Ars Tribunus Angusticlavius
9,589
Subscriptor
If you can query and fetch all the data in LESS time remotely than performing it on the server in a well structured sql query; what pathological issue are you dealing with.
I've run into this with recursive queries. The data was stored in a relational database, but what it was in effect was a tree with thousands of nodes. The SQL query would construct the tree by following the foreign key relations, progressively, and once finished would ask questions of the final structure.

Downloading the data in one go and then using Java (in this case, the programming language doesn't matter that much here) code on the server to filter it and query it proved one order of magnitude faster (at least, this was some time ago), and easier to understand as well.
 
Status
You're currently viewing only Apteris's posts. Click here to go back to viewing the entire thread.