countPersistentInstancesLim64

countPersistentInstancesLim64(limit: Integer64): Integer64;

The countPersistentInstancesLim64 method of the Class class returns the number of non‑exclusive persistent instances of the receiver class up to the Integer64 value specified by the limit parameter.

The countPersistentInstancesLim64 method is significantly faster than the size method on an instances pseudo‑collection, as shown in the following code fragments.

write Customer.instances.size;
write Customer.countPersistentInstancesLim64(500000);      // significantly faster

This countPersistentInstancesLim64 method can be used instead of the countPersistentInstances64 method to limit the time used, but the result will not be correct if the actual count is greater than the value of the limit parameter.

This method impacts other users of the database file where the instances of the receiver class are stored. The best time to run this method is therefore when there are few other active users.