I have done some digging on what the OPTION (FAST XXX)
query hint does inside a SELECT
statement and I'm still confused about it. According to MSDN:
Specifies that the query is optimized for fast retrieval of the first number_rows. This is a nonnegative integer. After the first number_rows are returned, the query continues execution and produces its full result set.
For me that does not make much sense but basically the query can get the first XXX rows really fast then the rest at normal speed?
The Microsoft Dynamics query that got me thinking on this is:
select pjproj.project,pjproj.project_desc,pjproj.customer,pjproj.cpnyid
from pjproj WITH (NOLOCK)
where project like '%'
order by project OPTION(FAST 500)
Can anyone explain exactly what this query hint is doing and its advantage over not using it?