A Shot of SQLEspresso

SQL Blogs by Monica Morehouse (Rathbun)

  • Home
  • Session Downloads
  • Event Calendar
  • PASS
    • Hampton Roads SQL User Group
    • SQL Saturday
    • PASS WIT VC
  • DCAC
  • Contact Me
    • Disclaimer
  • Home
  • Session Downloads
  • Event Calendar
  • PASS
    • Hampton Roads SQL User Group
    • SQL Saturday
    • PASS WIT VC
  • DCAC
  • Contact Me
    • Disclaimer

No Widgets found in the Sidebar Alt!

  • New SQL Version

    Approximate COUNT DISTINCT

    January 3, 2019 /

    We all have written queries that use COUNT DISTINCT to get the unique number of non-NULL values from a table. This process can generate a noticeable performance hit especially for larger tables with millions of rows. Many times, there is no way around this. To help mitigate this overhead SQL Server 2019 introduces us to approximating the distinct count with the new APPROX_COUNT_DISTINCT function. The function approximates the count within a 2% precision to the actual answer at a fraction of the time. Let’s see this in action. In this example, I am using the AdventureworksDW2016CTP3 sample database which you can download here.  SET STATISTICS IO ON SELECT COUNT(DISTINCT([SalesOrderNumber])) as DISTINCTCOUNT…

    Read More
    Monica Morehouse (Rathbun)

    Related Posts

    Master of None

    October 8, 2015

    Invest in Yourself Stop Making Excuses

    October 22, 2019

    Save Money On Your Azure Monthly SQL Database Bill

    August 22, 2018
  • Indexes,  New SQL Version

    New Resumable Online Index Create SQL Server 2019

    November 28, 2018 /

    SQL Server 2019 brings a very exciting new feature that, is long overdue. Resumable online index create is one of my favorite new things. This paired with the Resumable Index Rebuilds introduced with SQL Server 2017 really gives database administrators much more control over index processes. Have you ever started to build a new index on very large table only to have users call and complain their process is hung, not completing, or system is slow? That’s when you realize you’re the cause because you tried to sneak in a new index. I have many times, because creating a new index can impact performance and can be a problematic process…

    Read More
    Monica Morehouse (Rathbun)

    Related Posts

    Back to Basics: Why not parameterize?

    December 23, 2015

    Template Explorer Gold Mine in SQL Server Management Studio

    March 27, 2018

    System-Versioned Temporal Tables

    August 30, 2017

About Me

Monica Morehouse (Rathbun)

Microsoft MVP, Performancing Tuning Expert, Leader Hampton Roads SQL Server User Group, Read More…

Consulting

Sessions List

Favorite Tidbits

  • Reminder to Developers

Topic Categories

  • Azure
  • Back to Basics
  • Configurations
  • Data Masking
  • DevOps
  • Encryption
  • Idera Ace
  • Important Links
  • Indexes
  • Lone DBA
  • Misc
  • MVP
  • New SQL Version
  • Performance Tuning
  • Posts with Scripts
  • Problems & Solutions
  • Quick and Dirty
  • Security
  • Speaking
  • SQL Family
  • SQLSaturday
  • SSRS
  • Summit
  • Training
  • TSQL Tuesday
  • Uncategorized

Top Posts & Pages

  • What’s a Key Lookup?
    What’s a Key Lookup?
  • SSRS Report Won’t Render in VS Preview
    SSRS Report Won’t Render in VS Preview
  • Understanding Columnstore Indexes in SQL Server Part 2
    Understanding Columnstore Indexes in SQL Server Part 2
  • Invest in Yourself Stop Making Excuses
    Invest in Yourself Stop Making Excuses
  • Understanding Columnstore Indexes in SQL Server Part 1
    Understanding Columnstore Indexes in SQL Server Part 1
  • String Split Function in SQL Server
    String Split Function in SQL Server
  • TIL: Microsoft Azure Part 1
    TIL: Microsoft Azure Part 1
  • Storage Tiers What SQL Server DBAs Need to Know
    Storage Tiers What SQL Server DBAs Need to Know
  • What is Automatic Tuning in Azure SQL Database
    What is Automatic Tuning in Azure SQL Database
  • Identifying SQL Server Performance Problems Part 1
    Identifying SQL Server Performance Problems Part 1
Graceful Pro Theme by Optima Themes - 2026 ©
 

Loading Comments...