delete activities where unt_uid is null

删除unt_uid为空的活动

would be the fastest way but nobody can access the database / table until this statement has finished so this is a no-go.

这将是最快的方法,但是在此语句完成之前没有人可以访问数据库/表,所以这是不允许的。

I defined a cursor to get this task done during working time but anyway the impact to productivity is to big. So how to delete these record so that the normal use of this database is guaranteed?

我定义了一个游标来在工作时间完成这项任务,但是无论如何,它对生产力的影响是巨大的。那么,如何删除这些记录,以保证数据库的正常使用呢?

It's a SQL-2005 Server on a 32-bit Win2003. Second Question is: How Long would you estimate for this job to be done (6 hours or 60 hours)? (Yes, i know that depends on the load but assume that this is a small-business environment)

它是32位Win2003上的SQL-2005服务器。第二个问题是:你估计这项工作要完成多长时间(6小时或60小时)?(是的,我知道这取决于负载,但假设这是一个小型企业环境)

6 个解决方案

#1


9

You can do it in chunks. For example, every 10 seconds execute:

你可以用块来做。例如,每10秒执行一次:

delete from activities where activityid in 
  (select top 1000 activityid from activities where unt_uid is null)

Obviously define the row count (I arbitrarily picked 1000) and interval (I picked 10 seconds) which makes the most sense for your application.

显然,定义行计数(我任意选择了1000)和interval(我选择了10秒),这对您的应用程序最有意义。

更多相关文章

  1. logstash-jdbc-input与mysql数据库同步
  2. 数据库事务——还是这是一个规范化问题?
  3. fmdb 数据库升级1-----增加表字段
  4. SQL Server 2008 数据库镜像部署实例之三 配置见证服务器
  5. IFX数据库访问介绍
  6. JDBC连接并使用mysql数据库
  7. 从数据库sql中删除一个单词
  8. mysql数据库之表的操作
  9. 教你如何彻底卸载MySQL数据库

随机推荐

  1. android 去ListView滑动阴影
  2. Android沉浸式状态栏和手机虚拟按钮不兼
  3. Android 布局中 如何使控件居中
  4. Android 沉浸式状态栏实现,以及遇到的问题
  5. android的四大组件及其生命周期
  6. Android(安卓)获取设备和系统信息
  7. Android开发前奏
  8. Android(安卓)百度地图蓝点定位
  9. android ndk环境配置
  10. android 永远锁屏解决方法