Friday, July 6, 2018

ForceLiterals

ForceLiterals instructs the kernel to reveal the actual values used in the "where"
clauses to the database server at the time of optimization. This is the default
behavior in all "join" statements involving more than one table from the
following table groups:


Miscellaneous

Main

Transaction

Worksheet Header

Worksheet Line

The advantage of using this keyword is that the server now gets all information
needed to calculate the optimal access plan for a statement. The disadvantage is
that the access plan cannot be reused with other search values and that the
optimization may use more CPU resources on the database server. High
frequency queries should not use literals.
The following X++ statement is an example of how to use this keyword.



1
2
3
4
5
6
7
8
9
static void DemoForceLiterals()
{
  InventTrans inventTrans;
  while select forceliterals inventTrans
  order by itemId
  where inventTrans.DatePhysical >= mkdate(21,12,2012)
  {
  }
}

It is not possible to determine whether an index on itemId or an index on
DatePhysical should be used without considering the actual value of 21\12\2012.
Therefore, the keyword should be used as shown in the previous code sample.


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...