How many fields do we keep in the table

How many fields are possible in one table,

Is it good to maintain 150 fields in one table,

OR

Keep in touch with other tables,

Thanks Bharanikumar

+2


a source to share


4 answers


http://dev.mysql.com/doc/refman/5.0/en/column-count-limit.html



+3


a source


In the vast majority of cases, having 150 columns in one table is a symptom of a poorly denormalized database.

You might want to read this and reevaluate your db design.



To express this, go to the section "maintain relationships with other tables"

+4


a source


If you have a business need for 150 columns, then this is the "good way". I've never seen such a need in a business, but that doesn't mean it doesn't exist. I've seen very wide tables used in cases like olap, so if that's what you are doing, there is a good chance you are on the right track. If you are using this table for more otap functionality, then you are probably going down the wrong road. Perhaps if you could provide a little more information about what you are trying to accomplish, we could provide some advice (instead of "do it" or "do it differently").

0


a source


150-bit fields might be ok, but you should also consider the maximum record length your database will allow you to store. When using varchar fields, most databases will allow you to create a table that will theoretically violate the maximum size if all fields are filled to their maximum length. However, this will prevent you from actually adding records that are too long. This is the kind of trap that can last well for years until someone only adds one character to a potential insert and then explodes, and it usually takes a long time to find a fix problem. It is best to avoid creating a table in which the total column length is greater than the length of the maximum record bytes.

Smaller tables can also be queried faster.

Usually 150 columns is usually a sign that you really need to look at the design and see if the corresponding table is better. For example, if you have phone1, phone2, phone3, you need a matching phone table.

If you really want all 150 columns, consider which ones will most often be queried together. Put this parent table inteh. Then add the less frequently requested (or feature-specific columns) to the linked table. There is no reason not to have a 1-1 relationship between tables, just use the id from the parante sa PK table in the child table and also the FK in the parent table.

0


a source







All Articles