Post-processing in SQL versus code

I have a general query related to handling rows from a query. In general, I always try to format / process my rows in SQL itself, using numerous CASE WHEN statements to pre-format my db result, limit rows, and fill columns based on other columns.

However, you can also just select all of your rows and do post-processing in code (asp.NET in my case). What do you guys think is the best approach in terms of performance?

Thanks in advance, Stein

+2


source to share


1 answer


I would recommend doing the processing in code unless you have any network bandwidth considerations. The simple reason for this is that it is easier to make code changes than database changes. Moreover, performance is most often related to the actual database query and disk access, rather than the amount of data returned.



However, I'm assuming you are referring to "minor" formatting changes in the result. The standard where clauses naturally have to be executed in the database.

0


source







All Articles