-1

i have a huge data.what is the best way for store this data in database.store this data to one table or store in several table? if i want to save data to several table i must create table for every user.

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
adib16
  • 1,649
  • 2
  • 20
  • 35
  • It depends in what information you are going to store in table. Make sure data is `normalized`. – Pரதீப் Dec 30 '14 at 07:52
  • How is table count related with user count? – keltar Dec 30 '14 at 07:53
  • 1
    So? Save your text in db, it is surely possible. It doesn't say anything about relationship with user count, or why you wanted relational database at all. Since there are far too few mindreaders here, your chances to have an answer to so very unspecific question are close to none. – keltar Dec 30 '14 at 08:00

3 Answers3

3

I think a table per users is not a good, please read above link it will hwlp you to design a better and more efficient database

MySQL :: An Introduction to Database Normalization http://ftp.nchu.edu.tw/MySQL/tech-resources/articles/intro-to-normalization.html

Leandro Papasidero
  • 3,728
  • 1
  • 18
  • 33
2

In a relational dbms, data table size doesn't dictate the database design, but only the relations of entities.

So even with a table of billions of records holding large multi media data, you would not make this several tables, just because the table gets so big.

Maybe using an RDBMS is a wrong approach for your task. Maybe a NoSQL dbms would be better. Even a simple file system could be the way to go.

Maybe however, an RDBMS is the right approach. We don't know, because you have told us almost nothing about your database. And what seems huge to you may be considered small by your dbms.

Are you saying that you would have a huge table holding data for all users, but every user will only be interested in their own data? Then simply partition the table by user. The database design will remain the same, only the underlying storage and internal data access will be different. As long as your queries always select one user's data, you will stay within one partition and data access will be fast.

Here is how to partition a table:

alter table user_movies 
add primary key (user_id, movie_id)
partition by hash(user_id) partitions 100;
Thorsten Kettner
  • 89,309
  • 7
  • 49
  • 73
  • every user can upload file and create folder and sub folder like drop box or google drive .i put the file to a directory in hard and put a reference to that directory in DB.for this purpose one table is proper or create table for every user? – adib16 Dec 30 '14 at 09:11
  • As mentioned: you don't make it several tables, just because a table gets big. Make this *one* table. And by the way, this doesn't sound like a big table at all. It's just one entry per user? How many billions of users are you expecting? Don't worry too much. This is something very simple for a dbms to do. With an index on the user ID, access to a user's record will be extremely fast. – Thorsten Kettner Dec 30 '14 at 09:23
  • what is your idea about this answer ? http://stackoverflow.com/questions/1125004/which-is-more-efficient-multiple-mysql-tables-or-one-large-table?answertab=active#tab-top – adib16 Dec 30 '14 at 09:45
  • That answer says there are situations where you might want to split a table. This is correct. But it's not about splitting one table into many similar tables, but to split tables having many columns into several different tables. A user table can hold first and last name, date of birth, main address, eye color and shoe size, and you may decide - for one reason or another - that this should better be various tables instead. – Thorsten Kettner Dec 30 '14 at 10:06
1

So many factors you should be taken into consideration before making decisions. But how about this one, try "no-sql" type db, each user will be treated as key, the info about this user will be treated as value.

Tangoo
  • 1,329
  • 4
  • 14
  • 34