Solved

SQL Server 2008 start working 15 times faster after rebuild indexes-this is normal or mean there is problem?

Posted on 2014-04-05
6
777 Views
Last Modified: 2014-04-08
Dear experts

I’m a C# database developer with SQL 2008. Before a month I installed SQL Server 2008 R2 over WIndows R2 over super micro MB – X10 and now I detect the follow problem:

  One database start work VERY slowly – one complicated reports start require  25 sec, when I start manually my weekly rebuild procedure the report start to finished for 1.5 sec. The rebuild procedure is a SQL Agent task  - rebuild index, shrink DB, update statistics over all databases /system DBs included/. I check its history – it is run once time a week. Before I manually start the Maitanance plan, I restart the SQL Servers – it do not help. So I’m sure – the maitanance plan fix the problem.

 So now all is fine, but I start wonder – is it normal such behavior ? The DB is not heavy used, I’m afraid that this could mean HDD problem ? Is there somethink additional I should check ? I try in Windows Log, but find no problem…
0
Comment
Question by:dvplayltd
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 39979777
you would need to compare a execution plan of before a index rebuild and after...
apart from that:
* do your indexes have their own filegroup?
* do all of your tables have clustered indexes (which should NOT be on the index filegroup, but the regular table filegroup)

anyhow, indeed some "regular" index rebuild may help, though I recommend doing it too often for the full system, but instead eventually "regularly" on a dedicated table, if needed.
0
 

Author Comment

by:dvplayltd
ID: 39979954
To angel

Thanks for your advice. In fact I’m not very aware of indexes and DB performance .. but I’ll become I guess …

My indexes do not have its own filegroup /you mean the index to be saved on a separated file, right?/

I have one clustrered index for every table with INT .It is on primary DB file

What is interesting is that I found the problem, when I get a backup of SQL Server /remote/ and restore it on my DEV computers and the report of my DEV computer is done for 1,5 sec. Then I release the problem is not because of database desing and becuase the report is over 5 mounths, so I start a Maitance plan Rebuild DB on remote server and all is going fine.

 The procedure of restoreing a Database from full backup do not include internally reindexes, right? Then why the this fix the problem with DB speed??? My DEV PC is not so fast than the server ...

I get the feeling that the problem is solved actually NOT from the rebuild index, but from page reorder of data /this is included in my Rebuild DB Maitance/. What do you think, how can I make additional check what and why is happened? I’m sure, this will happened again, now the DB is not heavy used but with sure it will be in few months
0
 
LVL 69

Accepted Solution

by:
Scott Pletcher earned 500 total points
ID: 39983767
>> rebuild index, shrink DB, update statistics over all databases /system DBs included/ <<

That sequence is stepping over itself.

When you shrink a db, you can fragment all tables a lot.  Therefore, never routinely shrink a database.  You can shrink a specific database file(s) if you're deleted a lot of data and/or there's a lot of freespace in that file.

When you update statistics, you also lose all the stats from the index rebuilds.

Instead, you need to rebuild only indexes that are fragmented, specifying SORT_IN_TEMPDB if possible.  You should update statistics only on non-rebuilt indexes.

No, I don't think a maintenance plan can do that for you automatically.  You would need some type of custom code.
0
Transaction Monitoring Vs. Real User Monitoring

Synthetic Transaction Monitoring Vs. Real User Monitoring: When To Use Each Approach? In this article, we will discuss two major monitoring approaches: Synthetic Transaction and Real User Monitoring.

 

Author Comment

by:dvplayltd
ID: 39984964
To Scott

Thanks for your time.

For lucky next few mounts my DB will have 1-2 users for few hours per day, it size is now 100 MB so I have a time to test and to learn basic … and I’m surprised that with some small data wrong index could make 15 times faster operations …

 I was thinking that shrink make reorder of the pages and improve the speed, look the pic. I’m wrong? In fact you are correct, the shrink command I actually use do not turn on this option, but I can copy/paste t-SQL from here. What do you think? In fact, I have no problem with HDD space at all , I need to use shrink only if it help for performance.

For now I should use Maintenance plan, the business is not so big to pay a DB  administrator …

So my Maintenance plan will be:
1.      Daily update statistics /only this/
2.      One time in a week – Reorganize Index Task /instead of Shrink-this reorder index page for faster read, is that fine?/
3.      Once time in a month – rebuild index Task

This look fine to you? Other recommendation?


P.S: I’m sure your notes are correct, anyway what I detect at 100 % that after apply this wrong maintenance plan – one report from 25 sec. start to calculated for 1.5 sec. Too much difference over too small data .. is it possible to be die to HDD bad sectors
0
 
LVL 69

Expert Comment

by:Scott Pletcher
ID: 39986110
Yes, that looks like an excellent adjustment.

I guess it's possible it's a bad drive.  But those things don't usually get suddenly better, they just get worse and worse.
0
 

Author Closing Comment

by:dvplayltd
ID: 39986561
10x. I apply the new maitance plans + will check for physical bad sectors on HDDs
0

Featured Post

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Naughty Me. While I was changing the database name from DB1 to DB_PROD1 (yep it's not real database name ^v^), I changed the database name and notified my application fellows that I did it. They turn on the application, and everything is working. A …
SQL Server engine let you use a Windows account or a SQL Server account to connect to a SQL Server instance. This can be configured immediatly during the SQL Server installation or after in the Server Authentication section in the Server properties …
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …

691 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question