SQL Server Enum Implementation: A Single-Row View Strategy for Avoiding Magic Values

  • Comments posted to this topic are about the item SQL Server Enum Implementation: A Single-Row View Strategy for Avoiding Magic Values

  • Congrats on your first article! This is innovative approach to dictionary values in SQL.

    IMHO, the biggest benefit is not even pin-pointed: better execution plans for skewed values (parameter sniffing solution)!

    Columns like %Status, %Type usually have low number of possible values (eg 10-100), and are almost always skewed - bringing random slowness due to parameter sniffing problem. It is the best NOT to parameterize such values, to use lilterals. But certain database Frameworks (EF?) and certain apps (MS NAV / Business Central) do not have ability to specify which "parameters" to turn into values, not parameters. I think there we maybe could use this technique to solve parameter sniffing and get best possible performance.

    Great work!

    _____________________________________________________
    Microsoft Certified Master: SQL Server 2008
    XDetails Addin - for SQL Developers
    blog.sqlxdetails.com - Transaction log myths
  • Thanks, really appreciate your opinion, and great addition about "better execution plans for skewed values - parameter sniffing." 🙂

  • Nice. I use similar setups in app-level code, but I never thought to do it in SQL Server. Definitely going into the toolbox.

  • Thanks 🙂

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic. Login to reply