The month of June 2021 has been a very rewarding month for SQL in the Sixty Seconds YouTube channel. The channel got lots of new subscribers, comments, and views. I am really happy with the engagement of the YouTube Users. It seems that YouTube is now gaining more traction than text-based blogs. Let us see June 2021 Summary for SQL in Sixty Seconds.
In this video, we discuss the performance of SUM(1) and COUNT(1). Lots of people think the performance will not be the same but the real results say they are equal to each other.
A common myth is that COUNT(1) does not have to scan the table or index and it is faster. However, this is not a reality. When you run a test, you quickly know that they are performing equally, which I explain in this video.
A common misconception is that when you use COUNT(*), the SQL Server engine has to use table scan or index scan. However, the reality is very different. SQL Server Optimizer engine is very smart and knows which index to use. Optimizer always selects the index which is the most efficient for query in terms of resources.
You can’t say that index seeks are good and index scans are bad. It is totally possible that they both are good and bad. Honestly, index scan exists because they are needed for that operation. Think this way, if seeks are better, why would optimizers not always force seek. This is because seeking is not recommended in that scenario.
Do you plan to optimize for Ad Hoc Workloads? Well, you should if you have lots of ad-hoc workloads and in this video, I explain the same.
I personally do not like Join Hints. As a matter of fact, I do not like any kind of hint at all in my query. I believe using hints may negatively impact the performance and in this video, we can see the same situation. Once again, I will say SQL Server Optimizer usually knows what is best for it.
Lots of people think that if you write one query, it will have a single plan. No, it is not the case all the time. The query and its plan are dependent on the way the query is written – including the query case (upper case, lower case) or the space between the words. It is quite possible to have one query with multiple plans.
Maximum Worker Threads exists in the SQL Server for a while. However, it is not properly understood in the industry. In this video, I try to explain the concept in the simplest possible words.
I hope you liked my June 2021 Summary and also SQL in Sixty Seconds video. I request all of you leave comments and give me more suggestions for the video. I will be very happy to build a video on the topics you suggest.
Additionally, do let me know which one was your favourite video. Your suggestions always help.
Reference: Pinal Dave (http://blog.SQLAuthority.com)