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
Small retained shaping stubs remain distinct from a full reusable mold and working press.

SQL SERVER – AdHoc Queries and Optimize for Adhoc Workloads

April 16, 2021
Pinal Dave
SQL Tips and Tricks
Ad Hoc Query, SQL CPU, SQL Scripts, SQL Server, SQL Server Configuration

Optimize for AdHoc Queries reduces the first-use plan-cache footprint of ad hoc batches. A customer variable-query workload prompted testing.

Read More
Gouache painting of four sailboats moored beside a calm dock with posts topped by small vermilion lights

OS Thread of a Session: Map Session ID to Windows Thread ID

April 14, 2021
Pinal Dave
SQL Performance
SQL CPU, SQL DMV, SQL Scripts, SQL Server

To find the OS thread of a session, join sys.dm_os_tasks to sys.dm_os_threads on the worker address. This post reads the map for your own session and for every user session. It explains why idle sessions have no row, why parallel queries have several, and how to follow a thread in Performance Monitor.

Read More
Gouache painting of a row of six clay cups on a windowsill in blue, pink, cream, sage and vermilion

sys.dm_exec_valid_use_hints: Every USE HINT Your Server Knows

April 13, 2021
Pinal Dave
SQL Performance
Parameter Sniffing, Query Hint, SQL DMV, SQL Scripts

sys.dm_exec_valid_use_hints lists every USE HINT name that your SQL Server accepts. This post groups the 35 names on SQL Server 2025 and shows the compile error for a misspelled hint. It applies two hints and reads the plan to prove each one worked, then compares USE HINT with QUERYTRACEON.

Read More
Gouache painting: a row of eight wooden window shutters, alternately open and closed, with a mirror row beneath it where every shutter is the opposite; one shutter is painted vermilion

SQL Puzzle – SELECT ~ 1 : Guess the Answer

April 9, 2021
Pinal Dave
SQL Puzzle
SQL Operator, SQL Scripts, SQL Server

SELECT ~ 1 returns -2 because the tilde is the bitwise NOT operator and flips all 32 bits of an int. This post keeps the puzzle, tests the answer on SQL Server 2025 with five data types and shows where the tilde is useful.

Read More
Gouache painting: a row of eight windmills along a ridge at dusk, most sails turning and three standing still, one windmill with a vermilion sail

Threads With Zero Rows in a Parallel Plan, Measured

April 7, 2021
Pinal Dave
SQL Performance
Execution Plan, MAXDOP, Parallel, SQL DMV, SQL Scripts

A parallel plan can show threads with zero rows, and that is normal. This post reads the per-thread row counters of two real plans on SQL Server 2025 and shows where the empty threads come from. It also says when an empty thread points to a real problem.

Read More
Gouache painting of a long orchard row with one basket at the first tree holding a single vermilion apple

Top 1 and Index Scan: A Scan That Stops After One Row

April 1, 2021
Pinal Dave
SQL Performance
Execution Plan, SQL Index, SQL Scripts, SQL Top

Top 1 and index scan can sit in the same plan, and the scan still reads only a few pages. This post runs six queries on a table of 100,000 rows and reads their logical reads. It shows why TOP 1 reads three pages in one case and every page in another.

Read More
Gouache painting of a kitchen counter crowded with bowls around one large vermilion bowl of tomatoes

Cached Data Per Object in Memory: Read the Buffer Pool

March 31, 2021
Pinal Dave
SQL Performance
SQL DMV, SQL Memory, SQL Scripts, SQL Server

Cached data per object tells you which tables and indexes fill the buffer pool. This post builds two demo tables, empties their cache and reads part of the data. A query then lists the pages, megabytes and share of each index in memory. It also explains why the view is costly on a big server.

Read More
Previous 1 … 15 16 17 18 19 20 21 … 365 Next
  • Books
  • Testimonials
  • Privacy Policy

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