I have a pretty similar question compared to this one: Publish multiple tables from different PostgreSQL's schemas on GeoServer
The main difference is the amount of databases. Question above has only 4. I do have a lot more which will pretty much invalidate all the answers to that question.
So I will just repeat the above question changed in a way it matches my situation:
I have about 30 tables times 50 databases in PostGIS. I know that every PostGIS store must be connected with just one schema/database.
The reason we have 50 databases is the multitenancy setup. I do not want to put two customers in 1 database. Therefore the GeoServer workspace for every database also needs to be different.
What now happens is that the amount of connections to PostgreSQL (with PostGIS) will all get allocated, so that extra connections get blocked.
I know I can increase PostgreSQL's connection limit, but I'm not sure that I want to do that.
What is the most efficient way to publish these tables from different databases (and thus schemas) on GeoServer?