TLDR; No limits if your database is on Linux using ext4, 31995 if it's using ext3. For Window on NFTS: 4,294,967,295. Mac users: 2.1 billion
Expanding on the answer:
Every Postgres database uses a subdirectory on the disk, hence the limitation. You will probably run out of IOPS before you hit a database count bottleneck. Unless you are on ext3, which is limited to 32k subdirectory, ext4 lets you have unlimited subdirectories.
Other answers are worried about management hell because the question itself is old, and the world has changed a lot.
Backups
- If you are using a cloud solution, this is solved. Most cloud providers perform backups at the disk level, so the amount of databases is irrelevant.
- If you are using an on-premises solution, you will need to loop through each database, backing up everything. Yeah, no biggie.
Multi-tenant security
- Having each client using a different database:
pros:
- each client can be on a different version of the software
- each client can have custom tables
- client access is moved from your software to Postgres
- clients can be moved from database servers easily
cons:
- monitoring scripts have to loop through each database
- database migrations, indexes, maintenance has to be performed on each database
neutral:
- less code on your sass, more code on your ops