PDA

View Full Version : Is it too much a MySQL table with over 200 columns?


yaaay
10-08-2007, 08:47 PM
I need to save a lot of information which will be used as search filters. Since there are too many rows in the database, each of these filters has to be a single column of the table, so the search is fast enough. Some of them are numbers, others booleans, others strings, others dates, etc. Is it bad to add as much as 200 columns to the table? How will this affect the effectiveness of my database table? Thanks for your answers.

Jim Maryland
10-08-2007, 08:47 PM
While it is possible that you could have a data model that requires being that flat of a design, I'm guessing you need to take a look a it again to see if you can normalize things a bit more. Can you break out the information into tables that can be joined when needed?

Timo J
10-08-2007, 08:48 PM
Maximum number of columns is 4096 in MySQL (5.1). But there are other limits, so the effective number of columns may be fewer. For example, row size is 65 535 bytes.

Personally, I would reconsider some other approach because maintaining a table with 200 columns can be quite hard. Have you considered to use multiple tables?