![](http://headlineslist.com/images/banner.gif)
Which is better for storing favorites, multiple tables or one big table in MySQL?
|
01-26-2013, 12:44 AM
Post: #2
|
|||
|
|||
On a Small scale (10,000 users or less), having multiple rows Option 2 works. Option 1 would not be advisable ever because it would be really difficult to maintain (backup, restore, tune)
On a large scale(100,000+ users), you are really started to talk about semi-structured data and a NoSQL database is best. However, there is a workaround in MySQL which would be to use the XML field type. You could create a table that looked like: ID (this is the primary key of the table) USER_ID (this is an integer that references a USER table which also as ID as it's Primary Key) favorite_xml (this is the full list of favorite_xml) The favorite_xml could be something like this: <favorites> <favorite url="<url1>" /> <favorite url="<url2>" /> <favorite url="<url3>" /> <favorite url="<url4>" /> </favorites> However, if you want to have folders: <favorites> <folder name="Folder1" > <favorite url="<url1>" description="<description1>" /> <favorite url="<url2>" /> </folder> <folder name="Folder2" > <favorite url="<url3>" /> <favorite url="<url4>" /> </folder> <!-- uncategorized --> <favorite url="<url5>" /> </favorites> You may also want to read about JSON, which is superseding XML, but MySQL doesn't support natively. Ads |
|||
« Next Oldest | Next Newest »
|
Messages In This Thread |
Which is better for storing favorites, multiple tables or one big table in MySQL? - Pistol - 01-26-2013, 12:36 AM
[] - Steven V - 01-26-2013 12:44 AM
[] - Naturally Sleep - 01-26-2013, 12:44 AM
|
User(s) browsing this thread: 2 Guest(s)