Thursday, 29 October 2009

SQL Server - database mail - just “because you can”, doesn’t make it right!!

Was thinking the other day (discussing across the office with a couple of colleagues actually ;-) about using database mail out of SQL Server in relation to using .NET components to send mail – kind of a hot topic for us, or at least one that's heating up.


My opinion on this type of thing (thankfully shared by our DBA) is that despite the fact that SQL Server provides a very adequate email platform, and there are lots of MSDN type examples out there showing you how do this type of thing, sending bulk email from the database server (for – e.g. – an email marketing campaign type stuff) is bad form.


For one thing you're putting unnecessary load on the server and slowing down applications that are using the server for doing what it's designed to do (manage and serve up relational data), and for another thing – there is simply much better support for doing this type of thing outside of the database, in application code.


Here's my analogy; say you want to do some work on your car – among other tools, you have an adjustable spanner and a professional socket set. Using database mail for everything is like using the adjustable spanner for everything "because you can". You save overhead by not having to change tools here and there, but you spend much more time overall trying to get to places in the car that a professional socket set could reach with ease. And your mate who you asked to help you ends up standing around because he wants to use the spanner too…


The moral of the story - just "because you can", doesn't make it right!!



No comments:

Post a comment

Migrating (and Open-Sourcing) an Historical Codebase: SVN-to-Git

I have a SVN repo on my local machine that I have been shoving stuff into since before I knew how to use revision control systems properly (...