About This Blog

SQL Server internals information including my content from SQLBlog.com and SQLPerformance.com.
Showing posts with label Execution Plan. Show all posts
Showing posts with label Execution Plan. Show all posts

Wednesday, 28 July 2010

The “Segment Top” Query Optimization

The Segment Top Query Optimization

A question that often comes up on the forums is how to get the first or last row from each group of records in a table. This post describes a clever query plan optimisation that SQL Server can use for these types of query.