Foxhound is the better* Database Monitor for SQL Anywhere.
*better: More thorough, more relevant, more effective.
...more Alerts, more All Clears, more details, more control in your hands.
|
[Home] | [Table of Contents] | [Previous Section] | [Next Section] |
Breck Carter
Last modified: February 12, 1998
mail to: bcarter@bcarter.com
When a column is defined with DEFAULT AUTOINCREMENT the actual maximum value is determined once by looking at the data as soon as that value is first needed after the database is started. This means the speed of the first INSERT after database startup depends on how quickly SQL Anywhere can find the current maximum value. And that is the reason the manual says, "For performance reasons, it is highly recommended that DEFAULT AUTOINCREMENT only be used with columns defined as a PRIMARY KEY or with a UNIQUE constraint, or columns that are the first column of an index. This will allow the maximum value determined at startup time to be found without scanning the entire table."
It is also the reason that SQL Anywhere's handling of gaps created in a DEFAULT AUTOINCREMENT sequence by DELETE statements differs depending on whether the database is stopped and started or not, but that is left as an exercise for the reader.
Figure 28 shows that the first INSERT after startup takes less than two tenths of a second when DEFAULT AUTOINCREMENT is defined for the first column in a primary key or index (Tests 1 and 3) but that it takes over six seconds when the DEFAULT AUTOINCREMENT column is not indexed at all (Test 2).
Figure 28 - Startup Performance Of DEFAULT AUTOINCREMENT
|
You may or may not care about how long the first INSERT takes. The overall performance of DEFAULT AUTOINCREMENT is excellent, and it outshines alternatives to this feature. In particular, Figure 28 shows that later INSERTs work with rocket speed even if the column isn't indexed.
[Home] | [Table of Contents] | [Previous Section] | [Next Section] |