-2

I'm currently working on a site which will offer a blog for users to write.

My question relates to how to structure the database.

So all of you know how blogs are working. Some user posts an entry and the system puts it in the database. Now to the problem:

Is it better to have thousands of databases for each user and each blog? e.g. User A has a blog with its' entries and photos and got its own database "UserABlog" for it. User B, too, with the database "UserBBlog".

Or is it better to have a single database for all users which has a table for "entries" and "photos", etc. linked to each user via foreign keys? e.g. User A and B got their blogs and their entries and photos are saved in the database "blogs" in the tables "entries" and "photos" with foreign keys linked to User A, B and C.

Sebastian
  • 1,593
  • 4
  • 26
  • 41

2 Answers2

1

I'd say go with the 1 database, it's all the same application. It's much harder to control and modify schema of tables if you have to manage 1 database per user.

Farkie
  • 3,307
  • 2
  • 22
  • 33
1

Use one database.

TL;DR:

  1. blogs do not generate much data
  2. Blogs are simple
  3. You can partition large tables

Compared to other applications which have to deal with real time data, workflows and similar stuff blogs produce only tiny amounts of data. Most databases are built to handle big amounts of data and will happily handle hundreds or thousands of blogs.

Blogs usually do not have to deal with complicated security settings and access rules so you can create a pretty good implementation even without dedicated databases.

If you database grows to big you can still partition the tables. http://www.mssqltips.com/sqlservertip/2888/how-to-partition-an-existing-sql-server-table/

Oliver A.
  • 2,870
  • 2
  • 19
  • 21