Create Index Example With Include

Query: Execution Plan suggest Missing Index… Missing Index (Impact 93.0): CREATE NONCLUSTERED INDEX [<name>] ON [dbo].[tbTable01] ([Col01], [Col02], [Col03], [Col04]) Index: Good Better Include Col01 and Col03 to eliminate key lookup step. Note: 84 records = 12 minutes

Read Committed Isolation Level cause Deadlock.

SET TRANSACTION ISOLATION LEVEL READ COMMITTED will cause deadlocks if the table is very large without indexes. Having the query perform a table/index scan with the read committed option practically “locks” the table. The impact can be minimized if the procedures access the data using the correct index so it does a table/index seek, therefore... » read more

Monitor SQL Server Deadlocks

Querying SQL Server Extended Events for Deadlock history. Extended events capture a lot of data from the system and you should explore that as well. There have a lot of useful detailed information which is already being captured. Please have a look at this event on MSDN here. We are only concerned about the deadlocks.... » read more

Running out of disk space when updating a large table

When updating a large table using transaction, make sure there is enough space for the log file. This includes … BEGIN TRANSACTION Alter column in a table Create index Tips … Shrink database data and log files beforehand Break up the query into multiple queries Adding more space to the drive where the log file... » read more

Transaction Log is Full

Error: The transaction log for database ‘xxxxx’ is full due to ‘ACTIVE_TRANSACTION’. Fix: Backup the transaction log. Set database recovery model from “Full” to “Simple”. If database setup for Always On, make sure Always On is working and synchronizing on all secondary database servers. Backup Transaction Log If you don’t care about the transaction log... » read more

SQL Server Job Overlap

The SQL Server agent checks whether the job is already running before starting a new iteration. If you have long running job and its schedule comes up, it would be skipped until the next interval.

Transaction Log for TempDB is Full

Issue: The transaction log for database ‘tempdb’ is full due to ‘ACTIVE_TRANSACTION’ Fix: Restart server to clear up tempdb. Tempdb database is part of SQL Server System database and gets created every time SQL Server Service starts. Tempdb stores temporary operations (like sorting and grouping data output etc) and tables, it stores lots of  information in... » read more

Log Shipping vs Always On

AlwaysOn high availability group, HAG, is easier to maintain than log shipping. An AlwaysOn HAG gives you the flexibility of being able to fail over back and forth between your AlwaysOn replicas. Now lets take a look at Log Shipping. Without doing a cut and paste from the Microsoft books online there are five steps... » read more

Always On and SQL Service Account

Account Setup: Use the same account to run all SQL Server service for all node in the cluster. Account has Administrator permissions on all servers in node. Set in “Local Users and Groups”. Account has sysadmin SQL permission on all servers in node. Set in “Local Security Policy”. Account has log on as service policy... » read more