Gaps and islands

If you have never had the chance to read any of Itzik Ben-Gan’s work then you are in for a real treat. He does a great job presenting us with problems and solutions that are logical and well thought out as to get the performance you need. When looking at Gaps and islands the author continued his ability to present a problem that is faced often and how you and I may want to consider fixing it. If you don’t know Itzik Ben-Gan you will find him at a number of events such as PASS Speaking, you can find his books on Amazon and his articles in SQL Server Magazine, along with other places as well.

The first question that you may be asking yourself is what is a gap or an island. Consider this, you have a table that contains a number of invoices for customers. The invoices have been issued with an identity field or in other words each invoice is issued a number that is sequential. Normally you would not want to delete any of these but for example purposes let us assume that you have had one issue or another and a few of these records were deleted. If it was a few records that were scattered throughout your invoices then you have gaps and islands.

What makes this chapter a treat is not only did the author present us with a potential issue but he also provided the code base to create the problem along with four different solutions. Understanding each of these will help you not only in solving this problem but maybe others that you have been presented with as well. These different solutions help in understanding the way that we can work with the language and make the language work for us. In other words understanding these will better prepare you for other problems you may run into down the road.

For those of us who may feel up to learning a great deal I challenge you to do this… Read the problem, create the problem table on a test server and before you continue on with the chapter work with how to fix it. Once you feel like you have come up with a solution or have reached a point where you are done with the test continue on with the chapter. Apply the author’s techniques and spend time reading why he applied the solutions the way he did.


0 Responses to “Gaps and islands”

  1. Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s


Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Join 11 other followers