I am trying to create a table with the below query
Create Table PerformaceReport ( campaignID int, keywordID bigint, keyword varchar(8000), avgPosition decimal(18,6), cost int, clicks int, conv1PerClick int, impressions int, day datetime, currency varchar(8000), account varchar(8000), timeZone varchar(8000), adGroup varchar(8000), adGroupState varchar(8000), approvalStatus varchar(8000), lowestPosition varchar(8000), campaign varchar(8000), campaignState varchar(8000), convManyPerClick int, totalConvValue decimal(18,6), maxCPCSource varchar(8000), clientName varchar(8000), destinationURL varchar(8000), device varchar(8000), firstPageCPC int, isNegative bit, matchType varchar(8000), maxCPC varchar(8000), maxCPM varchar(8000), highestPosition varchar(8000), qualityScore int, keywordState varchar(8000), viewThroughConv int)
And i am getting the below error
#1118 - Row size too large. The maximum row size for the used table type, not counting BLOBs, is 65535. You have to change some columns to TEXT or BLOBs
Can anyone please let me know how to avoid this error and make the query work to create a table.
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?
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With