SQL Server Quick Tips

Published on: 2019-09-17

Earlier this year I made a series of videos that were played before the start of several DBA Fundamentals presentations. These videos gave viewers something SQL related to watch while the online rooms were filling up with attendees before the start of each day’s live presentation.

Since these videos only ran once, and because my regular filming location is under construction this week, I decided to republish them here today.

Hope you enjoy these quick tips on several SQL Server concepts.

STATISTICS IO, TIME

Enabling STATISTICS IO and TIME can help you benchmark your queries to see if your tuning efforts are helping or hindering execution performance:

Watch “STATISTICS IO, TIME” on YouTube.

Key Concepts

The terminology surrounding keys in relational databases can be confusing – in this overview we summarize the difference between primary keys, foreign keys, natural keys, and more:

Watch “Key Concepts” on YouTube.

SARGability

When performance tuning queries, one of first things to check is whether your queries are SARGable and allow the optimizer to seek to the data it needs:

Watch “SARGability” on YouTube.

Thanks for reading. You might also enjoy following me on Twitter.

Want to learn even more SQL?

Sign up for my newsletter to receive weekly SQL tips!

One thought on “SQL Server Quick Tips”

  1. Nice, short, to the point on the SET STATISTICS snippet. Well done, Bert.

    Just a bit of a warning though (you might want to add it to your snippet)… You do have to use some caution with SET STATISTICS. If you have Scalar or mTVF (Multi-statment Table Valued Functions), the use of SET STATISTICS will be terribly skewed making it look like the query is 10’s or even 100’s of times worse than it actually is. iTVFs (Inline Table Valued Functions) don’t suffer the same problem.

    Here’s a link to an article that demonstrates the problem.
    https://www.sqlservercentral.com/articles/how-to-make-scalar-udfs-run-faster-sql-spackle

Leave a Reply

Your email address will not be published. Required fields are marked *

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