About sqlsunday.com

This blog started as a collection of tips and tutorials that I wanted to share with friends and colleagues. From there it has grown to be my repository of nice-to-have documentation of the quirks of T-SQL development and performance tuning.

In the beginning, I used to publish posts every sunday morning – hence the name – but now I just post whenever I find the time and inspiration to write something down.

About the author

I’ve been a data warehouse and BI developer on the SQL Server platform for some 15 years, specializing in performance optimization. I’m currently working as a consultant and database developer, as well as the founder of my consultancy, Structured Concepts. When I’m not crunching T-SQL code and writing blog posts, I work as an indoor cycling instructor and sometimes do the occasional bit of photography. You will also find me posting the odd piece of code (and occasional mean comment) on Stack exchange.

If you want to keep track of new posts, make sure you like sqlsunday.com on Facebook and/or follow me on Twitter!

9 thoughts on “About

  1. Loving the website!!!!

    I’m sorry if this is not the right spot to be doing this, but this article has been extremely useful to me but a small question is killing me & I can’t seem to find an answer anywhere!


    I’ve successfully used your advice on partitioned views, but for the most part, when I build queries I never hard code in the date! For your example, I’ve used a Date Variable instead, but for some reason when using a date variable, the execution plan no longer utilizes the CHECK CONSTRAINT, and scans all 3 tables?? Below is what I mean:

    SET @Date = ‘2014-03-14’

    SELECT *
    FROM FACT.Sales
    where [date] = @Date

    This query will return the results of all 3 tables in the execution plan.

    • Without seeing your actual case, I’m guessing that the estimated query plan (not the actual one) will show a scan of all three tables because it doesn’t “know” the value of the variable.
      If you enable the “show actual query plan” option in Management Studio and rerun the query, do you still get the same result?

      • Thanks for the insight. So I’ve enabled the actual query plan, and it still does scan all the tables. However, when i hover over the table scan, I see “number of executions = 0” for the unrelated tables (which is what I want).

        This would make me believe that the execution display simply scans all the tables, but isn’t actually doing any executions.

        However if I decide to do an aggregate function… For example:

        SELECT SUM(retail)
        , Store
        FROM FACT.Sales
        WHERE = @Date
        GROUP BY Store

        In this instance of using the SUM aggregate instead of just SELECT *, my “number of executions” for each table is now 4 or more.

        Is it unable to recognize the constraints when leveraging aggregate functions? if that’s the case, it makes it a little tough for me due to the fact that I often times do so many aggregates by a store location, or a transaction, etc.

      • Hi Daniel, sorry for these posts on your about me section. I feel bad asking through this medium, so feel free to delete all of these! It seems after clearing everything out and re-creating it I’m getting my desired results. Thank you for your response on the *show actual query plan*.

        I will continue to follow and read your blog! Much appreciated.

  2. I am glad to have found your blog, and am finding it very helpful, even when it tickles the brain and makes me realize that i have yet to understand much more on various topics

  3. Just wanted to say thanks for your Youtube video on SQL Server Join Operators. Quick, informative and exactly what I was looking for.

    Did make me wonder about your accent though. German name, Anglo/Swedish with soft Scottish overtones ? Basically I don’t have a clue where your accent is from. But I am Icelandic/Finnish, what do I know.

    thanks again Daniel


Let me hear your thoughts!

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.