Contents IndexSorting query results How the optimizer works

User's Guide
   Part III. Using SQL Anywhere
     Chapter 21. Monitoring and Improving Performance
      Temporary tables used in query processing

Sometimes SQL Anywhere needs to make a temporary table for a query. This occurs in the following cases:

When temporary tables occur

In these cases, SQL Anywhere makes a temporary table before the operation begins. The records affected by the operation are put into the temporary table and a temporary index is built on the temporary table. This operation of extracting the required records into a temporary table can take a significant amount of time before any rows at all are retrieved from the query. Thus, creating indexes that can be used to do the sorting in case 1 above will improve the performance of these queries since it will not be necessary to build a temporary table.

Notes

The insert, update and delete cases above are usually not a performance problem since it is usually a one-time operation. However, if it does cause problems, the only thing that can be done to avoid building a temporary table is to rephrase the command to avoid the conflict. This is not always possible.

In ISQL, the statistics window displays "TEMPORARY TABLE" before the optimization strategy is listed if a temporary table is created by SQL Anywhere in carrying out the search.

Contents IndexSorting query results How the optimizer works