Skip to main content

Notifications

ForcePlaceholders

ForcePlaceholders instructs the kernel not to reveal the actual values used in
where clauses to the database server at the time of optimization. This is the
default in all non
-join statements. The advantage of using this keyword is that the
kernel can reuse the access plan for other similar statements with other search
values. The disadvantage is that the access plan is computed without considering
that data distribution might not be even, or that the access plan is an "on average"
access plan.
The following X++ statement is an example of when to use this keyword.



 1
2
3
4
5
6
7
8
9
10
11
static void DemoForcePlaceholders()
{
SalesTable salesTable;
SalesLine salesLine;
while select forcePlaceholders salesLine
join salesTable
where salesTable.SalesId == salesLine.SalesId
&& salesTable.SalesId == '10'
{
}
}

In the previous code example, the database server automatically chooses to
search the SalesTable using an index on salesId. The database server uses the fact
that the salesId column is a unique field and does not need the actual search value
to compute the optimal access plan.


Best Regards,
Hossein Karimi

Comments

*This post is locked for comments