DB for every customer

Just wondering, would it be crazy to create a DB for every customer? I started to created them by using the customerId as the DB name. Just wondering if I would run into performance problems down the road.

I don’t plan to have that big of a customer base, maybe 2-3k customers

Thanks!

@Alan_Spurlock Create a separate database for each tenant and configure the database connection string based on the tenantId.

If your product maintains fewer records for every customer means you can have a single database with tenantId.

Hi @Alan_Spurlock,

Welcome to MongoDB community.

My concern here is that with 2-3k customers you will endup with 2-3k X (number of collections per customer) = total collection number.

We have a known antipattern with large amount of collections and you might hit it with this design. Therefore, if possible I will consider doing a customerId field per document and index it to avoid thousands of collections.

I suggest to read the following blogs:

Best regards,
Pavel

2 Likes

Thanks for all that info! So… I am 100% guilty of setting this up as normal sql. I am so used to normalizing everything. My only concern is chat and call logs, but I can store the logs and chat with a max count and create another row to start new. (per customerId and chatId / callId)

I love reading articles like that. Love the humor too.

1 Like