Contents Index Optimize for first rows or for entire result set An index can usually be found to satisfy a predicate

ASA SQL User's Guide
  Query Optimization and Execution
    How the optimizer works
      Underlying assumptions

Statistics are present and correct

The optimizer is self-tuning, storing all the needed information internally. The system table SYSCOLSTAT is a persistent repository of data distributions and predicate selectivity estimates. At the completion of each query, Adaptive Server Anywhere uses statistics gathered during query execution to update SYSCOLSTAT. In consequence, all subsequent queries gain access to more accurate estimates.

The optimizer relies heavily on these statistics and, therefore, the quality of the access plans it generates depends heavily on them. If you recently inserted a lot of new rows, these statistics may no longer accurately describe the data. You may find that your subsequent queries execute unusually slowly.

If you have significantly altered your data, and you find that query execution is slow, you may want to execute DROP STATISTICS and/or CREATE STATISTICS.


Contents Index Optimize for first rows or for entire result set An index can usually be found to satisfy a predicate