web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

OPTION (FAST 2) In AX2012 Queries

(0) ShareShare
ReportReport
Posted on by

I've noticed a lot of the AX queries I look at use OPTION (FAST 2). My database has max degree of parallellism set to 1(As per Microsoft recommendtions). Why then would the queries use FAST 2? Is this coded into each query or is there a setting in AX where this gets appended to the queries?

Here's an example query:

declare @p1 int
set @p1=NULL
declare @p2 int
set @p2=0
declare @p5 int
set @p5=28688
declare @p6 int
set @p6=8193
declare @p7 int
set @p7=2
exec sp_cursorprepexec @p1 output,@p2 output,N'@P1 bigint,@P2 bigint,@P3 bigint,@P4 datetime2,@P5 datetime2,@P6 bigint,@P7 bigint,@P8 bigint,@P9 nvarchar(5),@P10 nvarchar(42),@P11 bigint',N'SELECT T1.BUSRELACCOUNT,T1.BUSRELTYPEID,T1.PARTY,T1.RECID,T1.MAINCONTACTWORKER,T1.SALESDISTRICT,T1.SEGMENT,T1.STATUS,T1.SUBSEGMENT,T1.COMPANYCHAIN,T1.CUSTGROUP,T1.VENDGROUP,T1.DEL_NAME,T1.RECVERSION,T2.NAME,T2.RECID,T2.PARTYNUMBER,T2.NAMEALIAS,T2.RECVERSION,T2.INSTANCERELATIONTYPE,T3.LOCATOR,T3.RECID,T3.RECVERSION,T4.LOCATOR,T4.LOCATOREXTENSION,T4.RECVERSION,T4.RECID,T5.CITY,T5.COUNTRYREGIONID,T5.COUNTY,T5.DISTRICT,T5.STATE,T5.ZIPCODE,T5.RECID,T5.RECVERSION,T6.PERSON,T6.RECVERSION,T6.RECID,T7.NAME,T7.RECID,T7.RECVERSION,T7.INSTANCERELATIONTYPE,T7.RECVERSION,T7.RECID FROM SMMBUSRELTABLE T1 CROSS JOIN DIRPARTYTABLE T2 LEFT OUTER JOIN LOGISTICSELECTRONICADDRESS T3 ON ((T3.PARTITION=@P1) AND (T2.PRIMARYCONTACTEMAIL=T3.RECID)) LEFT OUTER JOIN LOGISTICSELECTRONICADDRESS T4 ON ((T4.PARTITION=@P2) AND (T2.PRIMARYCONTACTPHONE=T4.RECID)) LEFT OUTER JOIN LOGISTICSPOSTALADDRESS T5 ON ((T5.PARTITION=@P3) AND ((T2.PRIMARYADDRESSLOCATION=T5.LOCATION) AND ((T5.VALIDFROM<=@P4) AND (T5.VALIDTO>=@P5)))) LEFT OUTER JOIN HCMWORKER T6 ON ((T6.PARTITION=@P6) AND (T1.MAINCONTACTWORKER=T6.RECID)) LEFT OUTER JOIN DIRPARTYTABLE T7 ON (((T7.PARTITION=@P7) AND (T6.PERSON=T7.RECID)) AND (T7.INSTANCERELATIONTYPE IN (2975) )) WHERE (((T1.PARTITION=@P8) AND (T1.DATAAREAID=@P9)) AND (T1.BUSRELACCOUNT LIKE @P10 ESCAPE ''\'' )) AND ((T2.PARTITION=@P11) AND (T1.PARTY=T2.RECID)) ORDER BY T2.NAME OPTION(FAST 2)',@p5 output,@p6 output,@p7 output,5637144576,5637144576,5637144576,'2016-01-21 14:23:14','2016-01-21 14:23:14',5637144576,5637144576,5637144576,N'agp',N'%23057',5637144576
select @p1, @p2, @p5, @p6, @p7

Cheers

Paul

*This post is locked for comments

I have the same question (0)
  • Martin Dráb Profile Picture
    237,965 Most Valuable Professional on at

    I'm no SQL Server specialist, but I don't thing it's related to the degree of parallelism. It asks SQL Server to optimize the query for fast retrieval of first two rows.

  • Community Member Profile Picture
    on at

    Sorry, actually thinking of a different setting regarding parallelism. Please ignore that part of my query.

    I'm more concerned with the use of fast 2 in AX queries. It often seems the query would be more efficient without this. I was wondering if this is something that's coded into each query or if there's a setting within AX where this could be enabled/disabled.

  • Verified answer
    Community Member Profile Picture
    on at

    OK, got what I was looking for.

    In AOT\Queries I got my query, expanded Data Sources and selected the table I'm interested in(smmBusRelTable). Within it theres a property called FirstFast. It can be set to Yes or No. No will prevent the fast 2 from being used in the query.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#1
Priya_K Profile Picture

Priya_K 4

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans