Skip to main content
edited tags
Link
Jimmy Hoffa
  • 16.1k
  • 3
  • 70
  • 80
Post Closed as "Duplicate" by JeffO, Dan Pichelman, gnat, user40980, jwenting
Tweeted twitter.com/#!/StackProgrammer/status/525687304250085376
Source Link
Phil Wright
  • 409
  • 1
  • 3
  • 6

500 databases or 1 database with 500 tables or just 1 table with all the records?

I currently have an application that is used by a single end customer. For ease of discussion assume the application only needs a single database table for all records. I now need to support multi-tenancy and so in the future I will have about 500 customers using the same database server.

  1. A possible solution is to have a separate database for each customer. As there will be around 500 customers that means having MySQL/SQL Server/Oracle/etc... host 500 separate databases. This sounds like overkill for a database server running on an average cloud based server.

  2. Another solution is to stick with the single database I already have but to have 500 different tables, one for each end customer. Each customer only averages around 2000 records in their own table. This is easy to implement and I would guess makes it easy to migrate the customer to another server, just move the entire table data over.

  3. Lastly I could stick to using a single table in the single database. Instead I add an additional column that identifies the customer the record belongs to. But then the table ends up with about 1,000,000 records which is the aggregate of all 500 customers that average 2,000 each.

I do not know enough about performance and scaling to know 1, 2, 3 is going to give the best performance. Any ideas?