Friday, July 6, 2018

FirstFast and Firstonly

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

No comments:

Post a Comment

Configure the Firewall on the Enterprise Portal Server

After you install Enterprise Portal, enable Web Server (HTTP) in Windows Firewall. If you do not enable the web server in Windows Firewall...