SQL SERVER – Sample Long-Running Query for Demonstrations

I often travel across the world presenting on SQL Server Performance Tuning Topics. When I am not busy with Comprehensive Database Performance Health Check, I like to train IT professionals with SQL Server Performance Tuning Practical Workshop. I personally believe that I can’t reach everywhere to help with SQL Server Performance issues but if I train more people on this topic, they can virtually replicate me to solve their SQL Server issues. Today we will talk about a sample long-running query which I use for my demonstrations.

SQL SERVER - Sample Long-Running Query for Demonstrations longrunning-800x366

Long-Running Query for Demonstrations

Quite often during the training, I demonstrate techniques to identify the long-running queries and how to troubleshoot them. Here is the query which I have built based on the WideWorldImporters database and it keeps on running on the extremely fast machine for over an hour.

USE WideWorldImporters
GO
-- Long Query
SELECT *
FROM [Sales].[InvoiceLines] il
INNER JOIN [Sales].[Invoices] i ON i.InvoiceID = il.InvoiceID
INNER JOIN [Sales].[OrderLines] ol ON ol.OrderID = i.OrderID
INNER JOIN [Sales].[Orders] o ON o.OrderID = ol.OrderID
GO

There are scenarios when I have to run the query much faster and in that case, I keep any one of them joins in the above script and remove the rest of the join.

I will be traveling to various different countries in Europe in September 2019. Here are the details of the my travel: September 2019 Training Updates – Czech Republic, Netherlands, Sweden, Denmark.

If you are interested in learning my SQL server Performance Tuning secrets, I strongly suggest that you enrole yourself in Recorded Online Classes SQL Server Performance Tuning Practical Workshop – Recorded Classes.

Let me know if you want to read about any particular topic of SQL Server Performance Tuning and I will be happy to blog about them in the future.

Here are a few additional blog posts on this topic:

Reference: Pinal Dave (https://blog.sqlauthority.com)

SQL Performance, SQL Scripts, SQL Server, SQL Training
Previous Post
SQL SERVER – Simple Example of READPAST Query Hint
Next Post
SQL SERVER – Find All Tables Containing Specific Column Name

Related Posts

1 Comment. Leave new

  • Hi,
    Have you thought about coming to Romania? Cluj-Napoca is Silicon Valley from Romania.

    Reply

Leave a Reply