Matrix field hits the table row size limit.
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 3.6k
- Forks
- 705
- Avg merge
- 1d 5h
- Merged PRs (30d)
- 134
Description
Description
In the current project, we are heavily using matrix field which contains a number of block type having a decent number of fields of different kinds. Lately, by adding new block types and fields, mysql started to throw an error (with around ~200 in the table):
PDOException: SQLSTATE[42000]: Syntax error or access violation: 1118 Row size too large. The maximum row size for the used table type, not counting BLOBs, is 65535. This includes storage overhead, check the manual. You have to change some columns to TEXT or BLOBs in /app/vendor/yiisoft/yii2/db/Command.php:842
It doesn't look like edge case with matrix fields and actually, some other Craft users might face the same issue.
I found some existing posts in stack exchange and stack overflow about kinda similar problem but suggested solution there (make changes in mysql server configuration or table engine) is impossible to implement due to different impediments with infrastructure and other things.
We discussed this issue with colleagues and suggested as an option to create a custom field type, based on matrix field, which will rely on multiple separated tables instead of multiple numbers of fields in a single table (like fields collections in Drupal).
Can you suggest any ideas how to solve this issue? What do you think about the new field type idea? In case we will implement new field type, can it be included into Craft core?
Steps to reproduce
- Create entry matrix field.
- Add a lot of block type (~20) with different types of fields (~10-15 per block type).
Additional info
- Craft version: 3.0.0-beta.28 and older
- PHP version: 7.1
- Database driver & version: Mysql
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
The issue names no files, tests, or code entry points. Start by reproducing the failure with a Matrix field containing about 20 block types and 10–15 fields each, then investigate how Matrix data is stored in MySQL; done would require an agreed approach that avoids the row-size limit and confirms the reproduction no longer fails.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- mysql, php
- Domain
- backend, databases
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100