Many columns

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
user___
Forum Contributor
Posts: 297
Joined: Tue Dec 05, 2006 3:05 pm

Many columns

Post by user___ »

Hi guys,
I am creating a table with around ten or eleven columns. I do know that it is absolutely wrong practise but I am not sure about this in my case because I have seven columns whose values are integers and will not be more than a thousand and others are varchars(45) which is its maximum value. I wonder whether it is better to separate them or leave them in the way they are.
User avatar
Kieran Huggins
DevNet Master
Posts: 3635
Joined: Wed Dec 06, 2006 4:14 pm
Location: Toronto, Canada
Contact:

Post by Kieran Huggins »

There's nothing wrong with having eleven columns - you should have as many as your data warrants.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Kieran Huggins wrote:There's nothing wrong with having eleven columns - you should have as many as your data warrants.
However, knowing when to normalize (and when not to) is something to be aware of.

For example, if several columns are basically repeated such as user1, pass1; user2, pass2; etc, then it may be better to have a separate table for them. .. But it does depend on circumstance and usage some too.
user___
Forum Contributor
Posts: 297
Joined: Tue Dec 05, 2006 3:05 pm

Reply

Post by user___ »

I did some benchmarking and I got better results when my tables are separted.
feyd: I do not have cols like user1, pass1, user2, pass2, etc. They are not similar but despite this as I have already said I get better results with different ones.
Thank you guys.
Post Reply