Itzik Ben-Gan

Itzik
Ben-Gan

Itzik Ben-Gan is a contributing editor to SQL Server Pro and a cofounder of SolidQ. He teaches, lectures, and consults internationally. He's a SQL Server MVP and is the author of several books about T-SQL, including Microsoft SQL Server 2012 High-Performance T-SQL Using Window Functions (Microsoft Press).

Check out Itzik's Puzzled by T-SQL blog.
Twitter: @ItzikBenGan

Articles
New Solution to the Packing Intervals Problem

Packing intervals is a classic T-SQL problem that involves packing groups of intersecting intervals into their respective continuous intervals. I set a challenge to myself to try and find an elegant solution that can achieve the task by using only one supporting index and a single scan of the data, and I found one.

First Look at System-Versioned Temporal Tables-Part 2: Querying Data and Optimization Considerations
This article is the second part in a two-part series about system-versioned temporal tables—a new feature introduced in Microsoft SQL Server 2016. Part 1 covered what system-versioned temporal tables are, how to create them and how to modify data in them. This article focuses on querying data and optimization considerations.
First Look at System-Versioned Temporal Tables-Part 1: Creating Tables and Modifying Data 6
SQL Server 2016 introduces support for system-versioned temporal tables based on the ISO/ANSI SQL:2011 standard. A table without system versioning enabled holds only the current, most recent, state of its rows. You cannot query past, deleted or pre-updated states of rows. For the purpose of our discussion, I’m ignoring row-versioning capabilities related to concurrency control, like the multi-versioning concurrency control (MVCC) support of the In Memory OLTP engine, and the row versioning support of the snapshot and read committed snapshot isolation levels for disk-based tables.
Improvements in Table Variables and Temporary Tables in SQL Server 2014 2

SQL Server 2014 introduces a number of gems that can make your solutions faster: support for inline index definitions, memory optimized table types and table valued parameters (TVPs), parallel SELECT INTO, relaxed eager writes and improved cardinality estimates for table variables. The last two improvements were also backported to SQL Server 2012. Some of the new features target specifically temporary objects, whereas others are more general and just happen to effect temporary objects as well.

Puzzle Me This: String Replacement 2
If you love numbers, logic and puzzles, this one is for you.
table data
Table Variable Tip 2
One great reason to use table variables rather than temporary tables is that table variables aren't affected when a user transaction rolls back.
missing puzzle piece
The Last non NULL Puzzle 8
Returning the last non NULL value is a common and simple need, but there's no straightforward solution.
question mark key
Use the TOP Filter's WITH TIES Option 2
Take a little quiz to see if you know what the TOP filter's WITH TIES option does.
database
Avoid Unnecessary Lookups when Using ROW_NUMBER for Paging
Eliminate unnecessary lookups to improve the performance of the typical solution for paging using row numbers.
data center
Compute a Trimmed Mean
Use the trimmed mean method to exclude outliers from the computation of an average aggregate.
table data
Learn How to Deduplicate Data 1
Discover a simple method for deduplicating data.
filter
Get Accurate Estimates with Filtered Indexes 1
Use filtered indexes and statistics for improved cardinality estimates.
number values
Find a Minimum Missing Value 5
Discover the most efficient method to identify the minimum missing value after the minimum existing value.
databases
Sequence and Identity Performance
Learn how SQL Server handles caching for sequence and identity, as well as how to determine the optimal cache size for your environment.
warehouse inventory
T-SQL Challenges: Replenishing and Depleting Quantities 4
Itzik discusses two T-SQL challenges: replenishing quantities and depleting quantities. He presents an efficient solution for replenishing quantities and challenges you to find an efficient solution for depleting quantities.

Digital Magazine Archives

Browse back issues of SQL Server Pro, from January 2007 through the last issue published in April 2014. Find the back issues here.

 

From the Blogs
Aug 27, 2015
blog

A Replacement for Maintenance Plan Backups

This blog post is a bit of a ‘repeat’ – since I already covered much of the rationale behind this post in Part 23 of my multi-part series on AlwaysOn Availability Groups and SQL Server Agent Jobs. But, I also figured that this is enough of an important topic to merit its own blog post....More
Aug 19, 2015
blog

Looking forward to Containers

Virtualization has long been a staple when it comes to computing. In essence, virtualization is really just the use of abstraction to make things either easier to manage or more fault-tolerant. Disks, for example, have long been virtualized in the sense that a single, physical, can easily be divided up into multiple logical (or virtual) volumes (or drives) just as easily as a number of discreet physical disks can also be virtualized into a single drive (via RAID) – which can further be partitioned into volumes, LUNs, and so....More
Jul 28, 2015
blog

AlwaysOn Availability Groups and SQL Server Jobs, Part 29: Practical Implementation Tips

My initial goal in writing this series of posts was to outline some of the concerns surrounding Availability Groups (AGs) and SQL Server Agent Jobs – and call out how there is virtually no guidance from Microsoft on this front and then detail some of the pitfalls and options available for tackling this problem domain. I initially expected this series of posts to have between 25 and 30 posts – according to some of the early outlines I created ‘way back when’....More
SQL Server Pro Forums

Get answers to questions, share tips, and engage with the SQL Server community in our Forums.

Sponsored Introduction Continue on to (or wait seconds) ×