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 :
Dynamics 365 Community / Blogs / DaxGeek / FirstFast and Firstonly

FirstFast and Firstonly

Hossein.K Profile Picture Hossein.K 6,648
FirstFast

FirstFast instructs the SQL-database to prioritize fetching the first few rows fast
over fetching the complete result set. This also means that the SQL-database
might select an index fitting the order by clause over an index fitting the "where"
clause. The FirstFast hint is automatically issued from all forms, but is rarely
used directly from X++.


Firstonly

When Microsoft Dynamics AX fetches data from the database, it transfers a
package of records in each fetch. This is called read-ahead caching and is
performed to minimize calls to the database. If it is known that only one record
will be fetched, you can disable the read-ahead caching with this qualifier.


NOTE: It is best practice to use this in the "find" methods on the tables.The following example illustrates the use of FirstOnly.


1
2
3
4
5
6
7
8
static CustTable findCustTable(CustAccount _custAccount)
{
CustTable custTable;

select firstonly custTable
where custTable.AccountNum == _custAccount;
return custTable;
}

Best Regards,
Hossein Karimi

Comments

*This post is locked for comments