Collection Contents Index Sorting query results How the optimizer works pdf/chap24.pdf

User's Guide
   PART 4. Database Administration and Advanced Use
     CHAPTER 24. Monitoring and Improving Performance       

Temporary tables used in query processing


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

When temporary tables occur 

In these cases, Adaptive Server 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 first case, 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 they are usually one-time operation. However, if problems occur, 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 Interactive SQL, the Statistics window displays "TEMPORARY TABLE" before the optimization strategy is listed if a temporary table is created by Adaptive Server Anywhere in carrying out the search.


Collection Contents Index Sorting query results How the optimizer works pdf/chap24.pdf