删除sql server表中的数据需要很多时间 [英] Deleting data in a sql server table takes much time

查看:85
本文介绍了删除sql server表中的数据需要很多时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个包含超过 3.8 亿条记录的表.我有一个存储过程:

I have a table which has more than 380 million records. I have a stored procedure which:

  1. 删除一些记录.
  2. 插入一些东西.

整个过程大约需要 30 分钟才能执行.其中 DELETE 需要 28 分钟.

The total procedure takes around 30 minutes to execute. Out of this DELETE takes 28 minutes.

Delete 是一个简单的语句,大致如下:

Delete is a simple statement, something along these lines:

Delete a where condition_1 AND condition_2 AND condition_3

有人可以帮我吗?

推荐答案

首先看看你的索引 和查询..它真的应该首先不需要 28 分钟 吗?

Firstly have a look at your indexing and query..it should really in the first place not take 28 mins ?

也许值得一看 数据库优化查询优化...也许您也可以尝试逐步删除记录..建议 这里..

It maybe worth taking a look at database tuning and query optimization...maybe you can also try to delete records incrementally..something suggested here..

这篇关于删除sql server表中的数据需要很多时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆