盾怪网教程:是一个免费提供流行杀毒软件教程、在线学习分享的学习平台!

SQL Server 索引重建 数据库优化加快查询的速度

时间:2024/5/25作者:未知来源:盾怪网教程人气:

[摘要]软件等级:更新时间:2016-11-11版本号:v5.7.10 MySQL Server x64官方正式版免费下载立即下载 SQL Server 索引重建 数据库优化加快查询的速度大家知...
MySQL Server x64官方正式版免费下载

软件等级:

更新时间:2016-11-11

版本号:v5.7.10

MySQL Server x64官方正式版免费下载

立即下载

 

SQL Server 索引重建 数据库优化加快查询的速度

大家知道在数据库中建立和索引的话可以大大加快查询的速度,但是随着插入删除操作索引的密度会下降,这是查询的速度会大大降低,怎么办,通过索引重建可以提高索引密度,下面是索引重建的代码,

set nocount on
declare @str varchar(500)
create table #tmpTable(TableName varchar(50),rows int,reserved varchar(50),data varchar(50),index_size varchar(50),unused varchar(50))
declare @table as varchar(50)
if not exists(select 0 from sysobjects where name='Reindex_Log')
 CREATE table Reindex_Log(DB varchar(20),RowsLimit int,Tablename varchar(50),TransDatetime datetime)
declare TblCur  cursor for
select '['+name+']' from sysobjects where xtype='u'
open TblCur
fetch next from tblcur into @table
while @@fetch_status=0
begin
 insert into #tmptable exec sp_spaceused @table
 fetch next from tblcur into @table
end

close TblCur

 


常见的网络操作系统有UNIX、Netware、Windows NT、Linux等,网络软件的漏洞及缺陷被利用,使网络遭到入侵和破坏。



关键词:SQL Server 索引重建 数据库优化加快查询的速度




Copyright © 2012-2018 盾怪网教程(http://www.dunguai.com) .All Rights Reserved 网站地图 友情链接

免责声明:本站资源均来自互联网收集 如有侵犯到您利益的地方请及时联系管理删除,敬请见谅!

QQ:1006262270   邮箱:kfyvi376850063@126.com   手机版