iterate more efficiently over Database objects