countPersistentInstances

countPersistentInstances(): Integer;

The countPersistentInstances method of the Class class returns the number of non-exclusive persistent instances of the receiver class.

The countPersistentInstances 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.countPersistentInstances;        // significantly faster

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.