mysql查询表大小不正确,mysql创建表查询中的行大小太大错误

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?

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值