We are using a JdbcAggregationRepository with a transactional Datasource. When JdbcAggregationRepository is started, if its table contains lots of rows, a transaction timeout may occur and make it fail to start.
Actually, when repo starts, doStart method is invoked, that method calls getKeys() and iterates over every row in order to count them, which may be quite long if repo contains millions of rows.
In order to avoid that issue, count could be implemented directly in the SQL query.
- links to