table with multiple columns or several tables with redundant data?
Posted 21 January 2013 - 08:42 PM
If i insert a particular value in say, 8 tables, just once, and access other fields of that table many times, is it faster than having a big table with like, 20 columns, and accessing multiple fields, provided i would be using queries like " select * from table" and other time consuming queries like count of all entries in the table??
Posted 21 January 2013 - 10:56 PM
2. Count all entries in a table is not time consuming as no records have to be read, mysql knows how many. (ie SELECT COUNT(*) FROM tablename).
Apart from those observations I haven't clue what you mean.
Posted 22 January 2013 - 09:48 AM
I have a website, on php and mysql.
A person registers, his username is stored in 8 different tables, which contain different info about him.
Referencing data becomes easier, but is very time consuming ( but, only once).
A person registers, his username is stored only once, but that table has many columns, say about 20.
Table becomes large.
which one is better?
I can select only the required values as you pointed out, but i would have to use "select * from table" at some places.
Edited by sid0972, 22 January 2013 - 09:53 AM.
Posted 24 January 2013 - 07:39 PM
not talking about 3NF or 5NF or BCNF, they are way over my head.
Posted 25 January 2013 - 12:17 AM
i have read about normalization , and, in a nutshell, it means that using the best possible queries to to the required job without having retrieve irrelevant data, right??
It's about not storing redundant data, organizing your data and designing your tables so you can use the best possible queries to do the required job.
What is the proposed structure of your 8 tables and the alternative single 20-column table?
Edited by Barand, 25 January 2013 - 12:25 AM.
Posted 25 January 2013 - 05:27 PM
table 1 table 2
info 1 info 3
info 2 info 4
and another 6 tables
the fields info1-info 4 will be stored repeatedly for a single user, whereas in main table they are stored only once for a single user.
Posted 26 January 2013 - 06:18 PM
Edited by Barand, 26 January 2013 - 06:38 PM.
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users