may, 2022

24may9:00 pm10:30 pmBlack Arts Index Maintenance - GUIDs v.s. Fragmentation - They're not the problem... WE ARE!Jeff Moden

Event Details

This is NOT your typical presentation on the fragmentation problems of Random GUIDs.  No… Instead we’re going to DESTROY THE MYTH OF RANDOM GUID FRAGMENTATION.

In one of the most ironic/heterodoxical turns of knowledge you’re ever likely to experience, we’ll see how THE USE OF RANDOM GUIDS CAN ACTUALLY PREVENT FRAGMENTATION!  In the end, you’ll witness the results of some simple testing that clearly demonstrate that you can easily insert literally MILLIONs of rows into a Random GUID clustered index with almost no page splits (not even supposed “good” ones) and LESS THAN 1% Logical fragmentation!

We’ll identify the real problem and the seriously effective yet incredibly simple two-part fix for it.  In the process, we’ll prove that Random GUIDs actually behave in a manner like most people expect a good index to behave, especially in but not limited to high performance OLTP environments as well as the benefits of doing so.

We’ll also learn how to use a new tool that I created (included in the ZIP file) to ACTUALLY SEE what an index looks like at the page level for all pages in a single graph.

Then, we’ll use that tool to lay waste to what people are currently calling “Best Practice” index maintenance. We’ll literally see what REORGANIZE does to an index at the page level and why it’s one of the very worst things you can do to your Random GUID and many other types of indexes even if you’re limited to the Standard Edition of SQL Server.  We also prove that REORGANIZE CAUSES ORDERS-OF-MAGNITUDE WORSE TRANSACTION LOG FILE USAGE than REBUILD especially for Random GUIDs.

As interesting and totally necessary sidebars, we’ll also see how the use of ever-increasing index keys could be (and frequently is) a major source of many of your fragmentation problems and we’ll also see that NEWSEQUENTIALID may NOT the answer that you’re looking for.