v4.7.4: Merge pull request #3266 from ProvableHQ/history_optimization

history feature optimization