SQL Server / Query Optimization / Merge Join Operator / Sort Operator

SQL Server / Query Optimization / Merge Join Operator / Sort Operator
Recently we had really nice meetup gathering here in Auckland. Was a beautiful evening, there were 20 people talking about SQL server, was perfect. One of the topics was “Merge Join Operator” For this demo I used SQL Server 2014 Developer Edition. As a database I used StackOverflow, you can download this DB from Brent Ozar web page, just follow the instructions How to Download the Stack Overflow Database via BitTorrent In this example I will use two tables Badges (25 million rows) and Users (8 million rows) and I will join them on Userid...
read more

SQL Server / Long Running Queries / Email Alert

SQL Server / Long Running Queries / Email Alert
This is example of long running queries of database within email alert, we already had example how you can use sp_send_dbmail stored procedure from msdb database to send backup size email daily, and how to send missing indexes report via email. This is just another use case of sp_send_dbmail stored procedure. I used following arguments to achieve this @profile_name (name of an existing Database Mail profile, type sysname, default NULL), If you are not sure about your profile account use the following script, it shows all the accounts for all...
read more