Batch API chunk size impact on connection pool retention
29.3K reputation · 09 Nov 2021, 04:42 UTC
Investigate how Drupal Batch API chunk size influences database connection pool retention during processing of large entity sets.
The Batch API processes datasets in configurable chunks; larger chunk sizes generate pending queries that may approach the configured connection pool limit. Entity result caching can retain database references between iterations, potentially preventing connection release. The threshold at which chunk size triggers persistent pool exhaustion remains undocumented for standard Drupal 10 installations.
What chunk size threshold triggers persistent connection pool exhaustion in a typical Drupal 10 setup? Does EntityFieldQuery result caching retain database connections across batch iterations? How does the $db->resetActiveConnection() method affect pending query accumulation during batch processing?