I am currently working on a restructuring of my site's database. Since the scheme I have now is not one of the best, I thought it would be useful to hear some suggestions from you.
To start, my site actually consists of widgets. For each widget, I need a table for settings(where each widget instance has its own user settings), a table for common(common elements between instances of the same widget) and userdata(saved user data in the widget instance).
So far I have had the following schema consisting of 2 databases:
- the first database where I had all the site maintenance tables (for example, users, widgets, logs, notifications, messages, etc.). PLUS table that I added each widget instance for each user who initiated it, is assigned a unique ID (so I have the following columns:
user_id, widget_idand unique_id). - the second database, where I saved all the data associated with the widgets. This means that for each widget (unique in it
widget_id) I had three tables: [widget_id]_settings, [widget_id]_commonand [widget_id]_userdata. In each of these tables, each row contained a unique_iduser widget. In fact, there were all user data stored in widgets.
To give a brief example of how my databases work:
First database:
users user_id = 1widgets widget_id = 1users_widgets user_id = 1, widget_id = 1, unique_id = 1
:
1_settings unique_id = 1, ..., ...1_common , ( )1_userdata unique_id = 1, ..., ... . , unique_id (, )
, .
"" , 2 . , (1_settings, 2_settings,..., n_settings).
. !
EDIT:
, MongoDB CouchDB, ? , , , .
, SQL NoSQL ?