DF195: FASTFIRSTROW hint is used.

Last modified: May 28, 2025

The topic describes the DF195 T-SQL code analysis rule.

Category

DEPRECATED

Message

FASTFIRSTROW hint is used.

Description

The FASTFIRSTROW table hint is deprecated. Use OPTION(FAST n) instead.

Additional information

The OPTION(FAST n) hint provides better control over query execution by specifying the number of rows the query optimizer should process before returning results. This allows for improved query performance and responsiveness, especially in scenarios where retrieving the first few rows quickly is essential. Migrating to OPTION(FAST n) ensures compatibility with future versions of SQL Server and aligns with best practices for query optimization.

Noncompliant code example

SELECT id
FROM dbo.DemoTable WITH(FASTFIRSTROW)
GO

Compliant solution

SELECT id
FROM dbo.DemoTable
OPTION(FAST 1)
GO