Row size too large error in mysql create table query

前端 未结 7 393
萌比男神i
萌比男神i 2020-12-08 06:56

I am trying to create a table with the below query

Create Table PerformaceReport
(
campaignID int,
keywordID bigint,
keyword varchar(8000),
avgPosition decim         


        
相关标签:
7条回答
  • 2020-12-08 07:22

    This problem came out in Laravel and I used text instead of varchar.

    0 讨论(0)
  • 2020-12-08 07:24

    I agree with the answer on using appropriately sized columns and TEXT over VARCHAR as the first step, but if you still hit limits you may want to change your collation settings for that table if you are using UTF-8 or another character set with more than one byte per character and do not need it (only storing English text for example). I did this to get around the limit you are hitting for a very wide table. Some more detail here.

    Differences between utf8 and latin1

    0 讨论(0)
  • 2020-12-08 07:26

    Try changing the storage engine to CSV.

    0 讨论(0)
  • 2020-12-08 07:32

    The total size of all fields in the table is more than the limit, 65535, that's why you are getting this error.

    You should use text type instead of varchar for long strings. Replace all varchar(8000) with text, and it should work.

    Or, even better, use appropriate data types instead of the "too large" ones. You don't really need 8000 characters to store currency, do you?

    0 讨论(0)
  • 2020-12-08 07:34
    • Every table (regardless of storage engine) has a maximum row size of 65,535 bytes. Storage engines may place additional constraints on this limit, reducing the effective maximum row size.
    • BLOB and TEXT columns count from one to four plus eight bytes each toward the row-size limit because their contents are stored separately from the rest of the row.
    • detailed information - Limits on Table Column Count and Row Size
    0 讨论(0)
  • 2020-12-08 07:35

    Use TEXT instead of VARCHAR. Because you're exceeding the maximum row size. if you use TEXT ,it is intended for large text columns. Max size of varchar is 65535. create a column with varchar(65535) but it would have to be the only column in the table.

    or

    problem is the row size limit for innodb tables, belowlinks you can find some approaches to solve this:

    http://www.mysqlperformanceblog.com/2011/04/07/innodb-row-size-limitation/ https://dba.stackexchange.com/questions/6598/innodb-create-table-error-row-size-too-large

    0 讨论(0)
提交回复
热议问题