Viewing execution plans is useful for troubleshooting queries and stored procedures. But sometimes the query or stored procedure takes a long time to run, or you cannot run it yourself because it modifies data.
You can view these plans by pulling them from the plan cache. SQL Server provides a way to do this:
UPDATE 7/18/2016 – When I first wrote this, I thought that this would show the actual execution plans. I have since learned that this shows the estimated execution plans. Hopefully some readers may still find it useful.
This is a query to view all current activity on the database server (assuming you have the proper permissions). You can see who is connected, if they have any open transactions, if they are blocked or blocking, and what exactly they are executing. (more…)
2NF, 3NF, and BCNF are rules for evaluating functional depencies, or FD for short. If you are not familiar with the concept of functional dependency, please see my post on 2NF where I describe it in detail.
If you’re ready to tackle 3NF, then let’s begin! (more…)
Second Normal Form (2NF) is where we start analyzing the relationships of columns within a table to each other. (more…)
Each row contains one value, of the appropriate type, for each column, and there are no duplicate rows.
This is a simple rewording of the formal definition:
“Let relation r have attributes A1, …, An, of types T1, …, Tn, respectively. Then r is in first normal form (1NF) if and only if, for all tuples t appearing in r, the value of attribute Ai in t is of type Ti (i= 1, …, n).”
Date, C.J. Database Design & Relational Theory. Sebastopol: O,Reilly Media, Inc., 2012. Print. (Emphasis theirs)
Have you ever seen a table where each row had a ‘start date’ and an ‘end date’? I’m sure most of us have seen one or created one.
These tables tend to pose a key problem (no pun intended) if the following business logic applies: “If two or more rows represent different date ranges for a single item, the ranges cannot overlap.” In other words, the date range must be unique from the start date until the end date for any particular item represented by the table. (more…)