Reputation: 796
My team is building an application and a question came up during a brainstorming meeting that I was unsure about so I figured I'd reach out to the Stack Overflow community to get some more opinions. Here's the gist of it:
id
.One of the developers suggested that we use a separate database for each organization's account to separate data between organizations and to increase performance. I'd never seen any Rails app that used multiple databases that way and I wasn't sure how to even do that in Rails.
My question to you then is:
Would we gain any benefit from using separate databases or is this adding an unneccessary level of complexity to the application?
Say there are 100 organizations. Each organization has 100 users. Each user has 100 posts and 100 comments.
Would querying through these tables be a major performance drain or would having 100 separate databases be unwieldy and cause more issues than it would be worth? Does this cause issues with migrations? The schema would be identical between organizations.
I'm not sure if that was a clear enough question so let me know if you need more information before answering.
I did read the following Stack Overflow articles but they really didn't help me with this decision.
Upvotes: 3
Views: 352
Reputation: 4027
Don't do it. It will just add a level of unnecessary complexity.
Don't optimize for a problem before it becomes a problem. If your application gets to a point where database performance is a huge bottleneck, address that issue then. For now, concentrate on writing good, fast queries
37 Signals just posted this article about how, with good hardware, they have managed to avoid sharding and the associated sys admin overhead.
Upvotes: 4
Reputation: 6942
You can shard database there are various gem is also available,but as per my point of view there is no need to create separate database for your app ,but it's up to you ,you can improve DB performance by various ways
Upvotes: 0