Search conditions
Examples
Compatibility
246
In this situation, the best approach is to execute statements that allow
Adaptive Server Anywhere to scan the new rows sequentially. The internal
statistics are automatically updated as a side effect, allowing the optimizer to
choose better plans for subsequent queries.
In unusual circumstances, however, these measures may prove ineffective. In
such cases, you can sometimes improve performance by supplying explicit
selectivity estimates.
For each table in a potential execution plan, the optimizer must estimate the
number of rows that will be part of the result set. If you know that a
condition has a success rate that differs from the optimizer rule. You can
supply this information by including an estimate in the search condition.
The estimate is a percentage. It can be a positive integer or can contain
fractional values.
Whenever possible, avoid supplying explicit estimates in statements that are
to be used on an ongoing basis. Should the data change, the explicit estimate
may become inaccurate and may force the optimizer to select poor plans.
♦
The following query provides an estimate that one percent of the
ship_date values will be later than 1994/06/30:
SELECT
ship_date
FROM
sales_order_items
WHERE ( ship_date > '1994/06/30', 1 )
ORDER BY ship_date DESC
♦
The following query estimates that half a percent of the rows will satisfy
the condition:
SELECT *
FROM customer c, sales_order o
WHERE (c.id = o.cust_id, 0.5)
Fractional values enable more accurate user estimates for joins, particularly
for large tables.
♦
Adaptive Server Enterprise does not support explicit estimates.
Need help?
Do you have a question about the Adaptive Server Anywhere and is the answer not in the manual?
Questions and answers