The maximum number of columns per table is likely being reached, or more specifically, the maximum row width. There’s a hard limit of 4096 columns per table, but as the MySQL documentation puts it: “the exact limit depends on several interacting factors.” Primarily, the length of a given row cannot exceed 64k. For utf8, for instance, VARCHAR fields contribute their length * 3 bytes to allocate enough space for the row.
Each ExpressionEngine custom field has at least two columns, typically 1 TEXT field to hold the contents, and 1 VARCHAR field to hold the field’s formatting type. The content column contributes only 9-12 bytes to the row length, because MySQL stores TEXT fields elsewhere. The formatting field column contributes up to 122 bytes to the row width (length of 40 times 3 in the case of a utf8 database, plus two bytes to store the length). Date fields and relationship fields are stored a bit differently, but the point is: you’re never likely to hit MySQL’s limit on the number of columns per table because the columns each contribute to the maximum row width.
So let’s say you have 520 custom fields, and assume that your database is utf8:
bytes from
6240 520 content columns
63400 520 field formatting columns
————————————————————
69640 bytes
Unfortunately, these sites will need a major re-think in how weblogs are being used to store and display content. Not being familiar with your site’s needs, I cannot recommend anything specific. But knowing that so far the sites have been duplicating weblogs and have identical custom fields, I’m wondering if you would be able to just have one weblog, and perhaps use categories to determine whether an entry was intended for one site or another. The site= parameter of the weblog tag would allow the templates of each site to display information from this one master weblog. That way, you have a total of 65 custom fields, period.
Of course, looking at why you have so many custom fields would be good too. What are each of the custom fields being used for? It’s likely that many could be repurposed as a single custom field, or as statuses, categories, etc. That might not be the case, but again, without more detailed information, it’s hard for us to make firm recommendations that you can immediately put into practice.
Hope you find a resolution in time!
Edited to add: the version of MSM bjs is using is the same that is in the latest build update of 20070918