我正在MySQL中运行一个报表。其中一个查询涉及将大量行插入到临时表中。当我试图运行它时,出现以下错误:
错误代码1206:锁定数超过锁表大小。
相关的查询如下:
create temporary table SkusBought(
customerNum int(11),
sku int(11),
typedesc char(25),
key `customerNum` (customerNum)
)ENGINE=InnoDB DEFAULT CHARSET=latin1;
insert into skusBought
select t1.* from
(select customer, sku, typedesc from transactiondatatransit
where (cat = 150 or cat = 151)
AND daysfrom07jan1 > 731
group by customer, sku
union
select customer, sku, typedesc from transactiondatadelaware
where (cat = 150 or cat = 151)
AND daysfrom07jan1 > 731
group by customer, sku
union
select customer, sku, typedesc from transactiondataprestige
where (cat = 150 or cat = 151)
AND daysfrom07jan1 > 731
group by customer, sku) t1
join
(select customernum from topThreetransit group by customernum) t2
on t1.customer = t2.customernum;
我读过更改配置文件以增加缓冲池大小将有所帮助,但实际上并没有任何作用。有什么方法可以修复这个问题,无论是临时解决还是永久性修复?
编辑:更改了查询的一部分。不应该影响它,但我做了一个查找替换并没有意识到它破坏了那个部分。不影响问题。
编辑2:在t1中添加了typedesc。我在查询中进行了更改,但在这里没有更新。