>Hi George -
>
>A couple of questions on a technical level : how does an autoincrementing field store the last value or is the max val calculated on the fly? If the latter, is there a speed hit? And what happens if data from two systems have to be merged ( a common business need amoung my clients ) etc.
>
>i.e. what are the limitations and downside of autoincrementing fields?
It's really hard for me to answer without entering into some degree of speculation. What I say here, therefore, may or may not come to pass.
I have to work on the assumption that implementation of the auto-incrementing feature has been wedged into the record insertion process. During that time, VFP locks the table header (APPEND BLANK and INSERT - SQL). I would imagine that during the period when the header is locked, VFP will grab the last value, increment it, save it back and update the field, then release the lock.
Assuming auto-increment uses a signed 4 byte integer this means that the total capacity would be 2,147,483,647. The maximum number of records for a VFP table is 1 billion or less than half of the total number of unique values.
The only place, therefore, where a performance hit
might be even noticable would be when a very large (say, 100,000+ records) were appended into a table at once.
George
Ubi caritas et amor, deus ibi est