SQL Window Functions Series: LAG() and LEAD()
Dive deep into the powerful SQL window functions, LAG() and LEAD(). Explore their intricacies, discover real-world examples, and avoid common pitfalls.
2023-12-11
6,522 reads
Dive deep into the powerful SQL window functions, LAG() and LEAD(). Explore their intricacies, discover real-world examples, and avoid common pitfalls.
2023-12-11
6,522 reads
Over the years, SQL Server Statistics have been discussed in countless blog posts, articles, and presentations, and I believe that they will remain a core topic for a while when speaking about performance. Why is that?
2023-10-04
A query is sometimes super fast and sometimes very slow. One of the main reasons for this problem is Parameter Sniffing. There are several approaches to addressing the Parameter Sniffing issue and this article discusses effective methods for handling Parameter Sniffing in SELECT statements containing a TOP clause.
2023-09-18
This is a short look at a technique that I discovered recently in Management Studio (SSMS). The technique is to compare two graphical execution plans in the tool to understand what they are doing and how two different queries might affect a particular system, both with the image and with the properties' data behind the […]
2023-11-24 (first published: 2021-03-30)
9,104 reads
In this article we look at how to interpret and use the results of STATISTICS IO when tuning SQL Server queries.
2021-02-17
There are plenty of experts that look to teach you about query tuning and the internals of query execution in SQL Server.
2020-07-18
159 reads
In this article we look at different use cases for columnstore indexes like when performing SQL Server count * queries.
2020-01-17
As SQL developers, we tend to think of performance tuning in terms of crafting the best table indices, avoiding scalar and table valued functions, and analyzing query plans (among other things). But sometimes going back to the spec and applying some properties of elementary math can be the best way to begin to improve performance of SQL queries which implement mathematical formulas. This article is a case study of how I used this technique to optimize my SQL implementation of the Inverse Simpson Index.
2021-05-07 (first published: 2019-09-12)
5,370 reads
Introduction Instead of going straight into the topic of the Query Store, I would like to start this Stairway Series by mentioning a few performance tuning scenarios that are very common to production DBAs. I think most of us have been in one of these situations at some time: An application experiencing slowness after a […]
2020-10-07 (first published: 2019-05-13)
6,518 reads
The IGNORE_DUP_KEY option for unique indexes specifies how SQL Server responds to an attempt to INSERT duplicate values: It only applies to tables (not views) and only to inserts. Any insert portion of a MERGE statement ignores any IGNORE_DUP_KEY index setting.
2019-04-05
By Steve Jones
This is my last week of the year working (I guess I come back...
Want to seriously boost your data skills? Mastering advanced SQL is the key, whether...
By Steve Jones
This is my last week of the year working (I guess I come back...
Comments posted to this topic are about the item Function Defaults
Comments posted to this topic are about the item Big Data or Small Data
Comments posted to this topic are about the item Level 4 of the Stairway...
I have created this function in SQL Server 2022:
CREATE FUNCTION dbo.AddInt (@one INT, @two INT = 1) RETURNS INT AS BEGIN RETURN @one + @two ENDHow can I call this and invoke the default value for @two? See possible answers