简体   繁体   中英

Will MyISAM type tables work better than InnoDB for large numbers of columns?

I have a MySQL InnoDB table with 238 columns. 56 of them are TEXT type, 27 are VARCHAR(255).

I am getting MySQL error 139 when users insert data sometimes. After research I found that I'm probably running into InnoDB row size/column size/column count limitations. (I'm putting it that way because the specific limits among those three things are interdependent.)

Docs on InnoDB give an idea of the limits. If I switch this table to MyISAM is it likely to solve the problem?

I understand the maximum row size of 65,535 bytes. I think I'm hitting InnoDB's additional 8000 byte limit somehow.

Switching to PostgreSQL is also a remote option, but would take much longer.


Regarding the quantity of columns:

The class backed by this table represents a questionnaire. There are hundreds of questions.

Each column represents an attribute that clearly and distinctly belongs to the class CapitalGrantProposal and no other class.

I could distribute the columns across several tables -- I could have tables capital_grant_proposal_part_1s , capital_grant_proposal_part_2s , etc. However, that would increase increase complexity to no good purpose.


Update:

Tried making the table MyISAM and it works. So I'm getting the MySQL error 139 with InnoDB but not with MyISAM.

So you might want to consider what Mark Byers stated in the comment above. Having a good table structure is important when it comes to data retrieval and query optimization. But having said that, its not always possible to do such changes. From what i know about both engines, it really depends on what you are using the db for. InnoDB supports transactions and row locking whiles MyIsam doesn't. If i remember correctly, MyIsam also doesn't support foreign key relationships so if you depend on them in your table structure, MyIsam is out. On the other hand MyIsam has support for full-text search which InnoDB doesn't support but you can get around that by building your own search capability using Lucene or some other library. Hope this helps....

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM