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 one long card sliding through a guide from an organized file box into a smaller tray.

SELECT a Single Row in SQL Server: SQL in Sixty Seconds #046

March 13, 2013
Pinal Dave
SQL Video
SQL in Sixty Seconds, SQL Server Management Studio, SQL Shortcut, SQL Top

To SELECT a single row for a quick look at a table, set up an SSMS query shortcut that runs SELECT TOP 1. The tests here show which row comes back, how an index or a heap changes it, what it costs on a 200,000 row table and when to add ORDER BY.

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
Four identical blank medals have different colored ribbons, and a hand attaches a red loop.

Breaking Ties Deterministically: Why ORDER BY Needs a Tie-Breaker

December 12, 2008
Pinal Dave
SQL Tips and Tricks
Best Practices, SQL Order By, SQL Paging, SQL Top

Tied scores can come back in any order, which breaks paging. Here is the one column that fixes it.

Read More
Gouache painting of two groups of record cards connected by a stone bridge

Top and Bottom Rows With a CTE in SQL Server: Part 2

March 10, 2008
Pinal Dave
SQL Tips and Tricks
CTE, SQL Scripts, SQL Top, SQL Union clause

Top and bottom rows with a CTE come from two ordered queries, one for each end of the table. This follow-up tests the reader’s single-CTE version and a two-CTE version on SQL Server 2025. It also compares a ROW_NUMBER version that read 336 pages against 4 for TOP, and shows what ties, empty tables and one-row tables return.

Read More
Previous 1 2
  • Books
  • Testimonials
  • Privacy Policy

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