This month's discount Comprehensive Database Performance Health Check · Testimonials
SQLAuthority with Pinal Dave
Home
  • Consulting
    • Health Check
  • Free Videos
  • All Articles
    • AI
    • SQL Performance
    • SQL Tips and Tricks
    • Interview Questions and Answers
    • SQL Puzzle
    • SQL Video
    • SQLAuthority News
    • Personal
  • Books
  • Consulting
Gouache painting of a tray of cream, sage and slate thread spools with one spool wearing a vermilion ring

Nullable Columns in a Database: List Them and Count NULLs

December 12, 2019
Pinal Dave
SQL Tips and Tricks
SQL Column, SQL NULL, SQL Scripts

Nullable columns in a database cost you ISNULL calls and OR IS NULL conditions in every query. This post lists them with a catalog query, compares the INFORMATION_SCHEMA version, and counts the real NULLs in each column. The count tells you which columns can become NOT NULL and which can go.

Read More
Gouache painting of a sagging plank shortcut over mud with a vermilion wheelbarrow stuck on it beside a longer dry gravel path

APPROX_COUNT_DISTINCT With GROUP BY: When Exact Wins

December 11, 2019
Pinal Dave
SQL Performance
SQL Function, SQL Scripts, SQL Server 2019

APPROX_COUNT_DISTINCT with GROUP BY returns an estimate for every group. A tested demo on 2,000,000 rows shows a memory grant of 207,616 KB for the exact count against 3,112 KB for the estimate, and a memory grant of 0 for the exact count once an index exists. It also shows the error on small groups, where 4,648 of 100,000 groups were off.

Read More
Gouache painting of a row of wicker baskets on a bench beside a full shelf of oven rolls, one basket holding a vermilion item

Queries Waiting for Memory: Read the Grant Counters

December 10, 2019
Pinal Dave
SQL Tips and Tricks
SQL DMV, SQL Memory, SQL Scripts

Queries waiting for memory are counted by the Memory Grants Pending counter and listed by sys.dm_exec_query_memory_grants. A tested demo holds a sort grant of 41,848 KB with a blocked query and reads it from the view. The post explains how to spot a waiting request and what causes the wait.

Read More
Gouache painting of two wooden chutes, one with a single vermilion marble at the bottom and one with a row of grey marbles

Row Mode Memory Grant Feedback: It Needs Level 150

December 9, 2019
Pinal Dave
SQL Performance
Execution Plan, SQL Memory, SQL Scripts

Row mode memory grant feedback needs compatibility level 150 or higher, while batch mode needs only 140. A tested demo runs a row mode sort and a batch mode sort at levels 140, 150 and 170. The row sort keeps its grant of 11,888 KB at level 140 and drops to 1,536 KB at 150.

Read More
A local radiator valve adjusts heat for one room

What is the Priority of Database Scoped Configurations? – Interview Question of the Week #254

December 8, 2019
Pinal Dave
SQL Interview Questions and Answers
SQL CPU, SQL Performance, SQL Server, SQL Server Configuration

Question: What is the Priority of Database Scoped Configurations over Global Configuration at Server Level?

Answer: This is a follow-up question.

Read More
Gouache painting of an open wooden dollhouse with six rooms in cream, slate blue and sage, the middle column with vermilion rugs

Database Scoped Configuration Options in SQL Server

December 7, 2019
Pinal Dave
SQL Performance
SQL Scripts, SQL Server 2019, SQL Server Configuration

Database scoped configuration options change how one database behaves, without touching the server. This post lists all 41 options on SQL Server 2025, finds the 7 ids that are missing, and changes and restores two settings in a demo database. It also answers the old question about configuration id 5.

Read More
Gouache painting of two matching baskets of sage pears on a market stall, one holding a single vermilion pear

Missing tempdb Files: master_files vs database_files

December 6, 2019
Pinal Dave
SQL Tips and Tricks
SQL Error Messages, SQL Scripts, SQL TempDB

Missing tempdb files show up as a mismatch between sys.master_files and tempdb.sys.database_files. This post compares the two with a query, simulates the missing files on a copy of the catalog, and shows the error log message that gives the cause. The fix is to correct the path and restart.

Read More
Previous 1 … 133 134 135 136 137 138 139 … 844 Next
  • Books
  • Testimonials
  • Privacy Policy

© 2006 – 2026 All rights reserved. pinal @ SQLAuthority.com