插入需要太长的sql server 2008 r2 [英] insert takes too long sql server 2008 r2

查看:66
本文介绍了插入需要太长的sql server 2008 r2的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




我有一个数据库,其中有几个表guid聚集列table1只有10行,table_2有300K行table_2也有3个触发器。



我在table_2(0.3 - 0.7)秒上非常简单地插入非常慢的插入(插入table_2(t50)值(1))



我使用sql management studio执行以下操作:



1-将guid设置为非群集。



2-添加具有自动增量的唯一ID集群列。



3- drop并重新创建表(管理工作室完成删除并重新创建时间应用更改)。



4-删除table_2上的所有触发器。



5-设置数据库备份模型简单。



我确实使用这个t-s缩小了数据库



ALTER DATABASE Mydatabase SET恢复简单

DBCC SHRINKDATABASE(Mydatabase,1)。



插入仍然需要(0.3 - 0.7)秒on_2 on table_2甚至在table_1



注意:

table_1只有3列和10行。



硬盘驱动器是ssd,cpu核心i7,内存16GB



任何想法??? !!

Hi
I have a database with several tables with guid clustered column table1 have 10 rows only, table_2 have 300K rows table_2 also have 3 triggers.

I faced a very slow insert on table_2 (0.3 - 0.7) sec on very simple insert (insert into table_2 (t50) values (1))

I did the following using sql management studio :

1- set guid to a non-clustered .

2- add int unique id clustered column with auto increment.

3- drop and recreate the table (management studio did the drop and recreate when apply changes).

4- drop all triggers on table_2.

5- set database backup model to simple.

and i did shrink the database using this t-sql

ALTER DATABASE Mydatabase SET RECOVERY SIMPLE
DBCC SHRINKDATABASE (Mydatabase , 1).

insert still takes (0.3 - 0.7) second on table_2 and even on table_1

Notes:
table_1 have only 3 column and 10 rows.

hard disk drive is ssd, cpu core i7 , ram 16GB

Any idea ???!!

推荐答案

有很多可能性。例如,您的硬件可能是原因,因此使用例如Windows性能监视器进行调查:

- 磁盘队列长度

- CPU利用率

- 内存问题,特别是分页。



另一方面它可能是数据库:

- 触发器做什么,长时间运行那里?

- 你在桌子上有多少索引

你可以使用SQL Server Trace调查这些



最后一个元素就是网络。如果SQL Server跟踪显示合理的响应时间,那么将调查网络。
There are a lot of possibilities. For example your hardware might be the cause so investigate using for example Windows Performance Monitor:
- disk queue length
- CPU utilization
- memory issues, especially paging.

On the other hand it might well be the database:
- what do the triggers do, long running operations there?
- how many indexes you have on the table
You can use SQL Server Trace to investigate these

And the last element is the network. If the SQL Server trace shows reasonable response time which, then investigating the network would be in place.


这篇关于插入需要太长的sql server 2008 r2的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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