top of page


The Curious Case of the Missing Histogram
A 7-million-row table. A clustered primary key. Auto-update statistics enabled. Yet the index statistics had never been updated, and the histogram was missing. At first, it looked like a SQL Server bug. The real explanation was much more surprising—and reveals an important detail about how the optimizer decides when a histogram is actually needed. Along the way, I'll also cover a recent enhancement to Ola Hallengren's maintenance solution inspired by this edge case.
Guy Glantser
Jun 264 min read


סדר העמודות באינדקס
כבר הרבה מאוד שנים שה-execution plans כוללים המלצות לאינדקסים, וכך גם כלים כמו sys.dm_db_missing_index_details, ובימינו התווספו להם כלי AI שאמורים להחליף אותנו או את שיקול דעתנו. הבעייה העיקרית עם כל הנ"ל שהם נותנים המלצות טובות למקרה ספציפי, אבל לנו יש עדיין את שיקול הדעת כיצד להימנע מריבוי אינדקסים, וכיצד לבנות אותם כך שיביאו תועלת גם במקרים אחרים; ובמקרה השני עוסק הפוסט הזה. נכין קודם כל את רשימת החומרים: Use tempdb Go Drop Table If Exists Bad; Select 1 N, * Into Bad F
Geri Reshef
Apr 255 min read


Cascading Foreign Keys: I Was Against Them… Until I Finally Understood Why
For years, I avoided cascading foreign keys without fully understanding why. Then I discovered what SQL Server really does under the hood - escalating locking behavior to guarantee consistency. Combine that with missing indexes, and a simple delete can lock entire tables. Here’s why ON DELETE CASCADE deserves more respect than we give it.
Guy Glantser
Mar 243 min read


When Statistics Stay Empty Forever: A Hidden Edge Case with Empty Tables
Many SQL Server DBAs rely on automated statistics maintenance solutions, but they might be unaware of a corner case that can cause statistics to remain empty forever.
Guy Glantser
Mar 53 min read


שימושים מורכבים ב-Join
אני מניח שכל מי שקורא את הפוסט יודע מה ההבדל בין Inner Join ל-Left Join, והכוונה שלי היא לטפל במקרה יותר מורכב. נניח שיש לנו 3 טבלאות:...
Geri Reshef
Sep 24, 20257 min read


שימוש ב-NoLock למעקב אחר עדכון טבלה
השימוש ב-NoLock כדי לשפר ביצועים ולהתגבר על נעילות מוכר ופופולרי מאוד. מצד שני יש מי שהמונח NoLock גורם להם לעטות ארשת מבשרת רעות על...
Geri Reshef
Jul 4, 20253 min read
bottom of page
