我有一个1000万记录没有索引的表,我试图重复表格。我尝试插入选择使用左连接或不存在;但每次我都会收到违反密钥的错误。另一个问题是日志文件变得太大,事务将无法完成。我尝试将恢复设置为简单,因为建议在线,但这并没有帮助。以下是我使用的查询;SQL日志文件越来越大
insert into temp(profile,feed,photo,dateadded)
select distinct profile,feed,photo,dateadded from original as s
where not exists(select 1 from temp as t where t.profile=s.profile)
这只是产生违规的关键错误。我尝试使用以下物质:
insert into temp(profile,feed,photo,dateadded)
select distinct profile,feed,photo,dateadded from original as s
left outer join temp t on t.profile=s.profile where t.profile is null
在这两种情况下,现在的日志文件中的交易完成之前填满。所以我的主要问题是关于日志文件,我可以找出与查询的重复。
我会尝试这个 – vbNewbie 2012-03-28 15:22:45
有人告诉我,无论使用批处理的,我需要对源表这是我做的一个非聚集索引没有,因为它确实包含模糊。或者如何做到这一点呢? – vbNewbie 2012-03-28 15:52:22
索引不一定要是唯一索引 – HLGEM 2012-03-28 17:23:20