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
10,969 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
10,969 reads
Welcome to part twenty of the plansplaining series. It has been a long time since I last wrote a plansplaining post, partly because of my health, but also for a large part because I was out of ideas. But recently I decided to dig a bit deeper into a feature that was released in SQL Server 2017 and that I had so far not played with: SQL Graph.
2023-12-06
I’ve quietly resolved performance issues by re-writing slow queries to avoid DISTINCT. Often, the DISTINCT is there only to serve as a “join-fixer,” and I can explain what that means using an example.
2023-11-06
In this article, we look at why SQL Server may not use a non-clustered index over the clustered index and what you can do to improve performance.
2023-10-30
In this article, we look at execution plans and performance of a natively compiled stored procedure versus a traditional stored procedure.
2023-10-16
This article compares the performance of finding the most recent row in a child table for updates, looking at four possible solutions.
2023-07-10
3,772 reads
This article describes the N+1 problem that we often find when developers use row by row solutions for querying related data in a database.
2023-06-21
4,838 reads
We need to monitor our servers, but individual metrics have more complexity than just setting simple limits for their readings.
2023-02-06 (first published: 2023-01-30)
328 reads
Today Grant wonders why we spend so much time trying to learn about query tuning.
2022-07-23
314 reads
2022-03-09
540 reads
By Steve Jones
Thanks to everyone for attending my talk today at Day of data Baton Rouge...
Here’s the scenario: one of my SQL Server instances migrated to the DR array....
By Steve Jones
We are product focused at Redgate Software. Here is another of our values that...
WA:0821-4447-7715 Jl. Ir. H. Juanda No.118, Lebakgede, Kecamatan Coblong, Kota Bandung, Jawa Barat 40132
Hub Cs:08218154374 Jl. Jend. A. Yani No.47, Langkai, Kec. Pahandut, Kota Palangka Raya, Kalimantan...
Hub Cs:08218154374 Jl. Jend. Sudirman No.30, Ps. Pagi, Kec. Samarinda Kota, Kota Samarinda, Kalimantan...
In SQL Server 2025, I run this code:
select bit_count(-1)What is returned? See possible answers