mysql创建表查询中的行大小太大错误 [英] Row size too large error in mysql create table query
问题描述
我正在尝试使用以下查询创建表
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)
我收到以下错误
#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.
推荐答案
表中所有字段的总大小超过限制65535,这就是为什么会出现此错误的原因.
The total size of all fields in the table is more than the limit, 65535, that's why you are getting this error.
对于长字符串,应使用text
类型而不是varchar
.将所有varchar(8000)
替换为text
,它应该可以工作.
You should use text
type instead of varchar
for long strings. Replace all varchar(8000)
with text
, and it should work.
或者,甚至更好的是,使用适当的数据类型而不是太大"的数据类型.您真的不需要8000个字符来存储currency
,对吗?
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?
这篇关于mysql创建表查询中的行大小太大错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!