[Bug 8430] Improved handling for large number of databases