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
A sloping egg rack at a market stall, one hand taking the oldest egg from the front, another adding a fresh one.

DELETE TOP With ORDER BY: Removing the Oldest Rows First

May 1, 2024
Pinal Dave
SQL Tips and Tricks
CTE, SQL Delete, SQL Order By, SQL Server, SQL Top

Use DELETE TOP safely through an ordered CTE, preview oldest rows, apply a supporting index, and remove eligible rows in bounded batches.

Read More
random rows

SQL SERVER – Techniques for Retrieving Random Rows

August 25, 2023
Pinal Dave
SQL Tips and Tricks
SQL Function, SQL Random, SQL Top

This post will explore various techniques to retrieve random rows in SQL Server and analyze their performance and randomness characteristics in depth.

Read More
Index Scan

SQL SERVER – Top 1 and Index Scan

April 1, 2021
Pinal Dave
SQL Performance
Execution Plan, SQL Index, SQL Operator, SQL Scripts, SQL Server, SQL Server Management Studio, SQL Top

Scans are not always bad they are there because they are needed. Let us see a very simple demonstration about Top 1 and Index Scan.

Read More
A knife block with five large knives, beside one small pot holding all the smaller utensils bunched together.

Top N Plus Others: Grouping the Rest Into One Row

December 3, 2020
Pinal Dave
SQL Tips and Tricks
Ranking Functions, SQL Group By, SQL Scripts, SQL Server, SQL Top

Create top N plus others summaries with deterministic category ranking, one remainder total, stable labels, and explicit display ordering.

Read More
A hand picking the three ripest red strawberries from each plant along a garden row

Top N per Group: Three Ways and Which Is Fastest

January 29, 2015
Pinal Dave
SQL Performance
Execution Plan, Ranking Functions, SQL Performance, SQL Server, SQL Top

Compare top N per group with ROW_NUMBER, APPLY and a correlated subquery, define tie behavior, and measure plans with a supporting index.

Read More
A figure with a metal detector digging at the first spot near the dunes, a vast unexplored beach beyond.

Row Goals: Why TOP and EXISTS Change the Plan

July 14, 2010
Pinal Dave
SQL Performance
Execution Plan, Query Hint, SQL Performance, SQL Server, SQL Top

Inspect row goals from TOP and EXISTS, read EstimateRowsWithoutRowGoal, and compare a targeted optimizer hint using actual plans.

Read More
  • Books
  • Testimonials
  • Privacy Policy

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