473,394 Members | 1,797 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Disable and Rebuild or Drop and recreate Index

Hello all,
I am new to managing indexes on large tables and need some help.
Hopefully, I am not repeating question here. I searched as much as I
can, but not finding relatively best answer..

Here is my scenario.
I have 2 tables with more than 4 mil rows (1 - 2.8 Mil, 2 2.1 mil). Of
these tables, there are about 25 ( select ) queries run to help
generate reports every week.

Also, every week, there will be some new data in both tables (about
25k in each tables). To improve select performance, based on few
columns that are frequently used in those queries, I added Non-
Clustered Indexes on these columns ( about 4 in each table ) on both
tables.

Now, for the first time, the performance was great.. And I am now on
2nd week, where I have to import new weekly data. I am debating as to
disable and rebuild all index or just drop and recreate.

I have tried drop & recreate, it takes about 1.5 hr to finish, which
then defeats the performance improvement argument.

Can someone please share their expert knowledge/experience about the
best way to use indexes in this scenario?

Many thanks,
JB
Jun 27 '08 #1
1 7156
(ds**********@gmail.com) writes:
Here is my scenario.
I have 2 tables with more than 4 mil rows (1 - 2.8 Mil, 2 2.1 mil). Of
these tables, there are about 25 ( select ) queries run to help
generate reports every week.

Also, every week, there will be some new data in both tables (about
25k in each tables). To improve select performance, based on few
columns that are frequently used in those queries, I added Non-
Clustered Indexes on these columns ( about 4 in each table ) on both
tables.

Now, for the first time, the performance was great.. And I am now on
2nd week, where I have to import new weekly data. I am debating as to
disable and rebuild all index or just drop and recreate.

I have tried drop & recreate, it takes about 1.5 hr to finish, which
then defeats the performance improvement argument.
Did you try importing the new rows with the index present?

I would tend think that if you only import 25000 rows, that the
penalty you will get from having the indexes in place will not be
that severe.

Then again, I would not really expect it to take 1½ hour to drop and
rebuild four non-clustered indexes on a four-million rows table.
--
Erland Sommarskog, SQL Server MVP, es****@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pro...ads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinf...ons/books.mspx
Jun 27 '08 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Rod Davis | last post by:
Once a week, we run a script to drop all the indexes on tables in our db, followed by another to add those indexes back (we insert every day, so we do this to prevent index fragmenttation). The...
1
by: xo55ox | last post by:
Hi, I want to find out what is a good way to identify indexes that need rebuilding. I tried to run DBCC showcontig and identify them based on the scan density %. And according to a Microsoft...
7
by: Ansti | last post by:
I have a huge table in it own tablespace (250 GB). I just deleted more than half of the columns in that table, but I didn't see any change in allocated space. I did DBCC CLEANTABLE and DBCC...
6
by: ruben | last post by:
Hi: I'm running a large database on PostgreSQL 7.1.3. 20 days ago the database failed with a threatening and not too descriptive error like: pg_exec() query failed: server closed the...
10
by: wackyphill | last post by:
After rebuilding an index, it still shows as the same amount of fragmentation. ANy ideas what's wrong? I'm determining which indexes to rebuild using the following query: SELECT...
3
by: Challenge | last post by:
Hi, I have a table creation script that generated by ERWin. An index name is too long and has been truncated as "XPKsp_prj_stk_ord_". Now I want to drop and recreate it as another name. I got...
4
by: =?Utf-8?B?S2VycnlD?= | last post by:
I am trying to disable a list item in a drop down list. The list looks something like "Item 1 Other items that may interest you Item 2 Item 3"
1
by: digitalox | last post by:
All efforts to rebuild indexes fails. Not with an error, but they still show high fragmentation. The environment: SQL Server 2005 in 2000 compatibility mode non-clustered indexes on tables that...
4
by: frostbb | last post by:
I have a C# WinForms treeview with 20 or so 'level 0' nodes. My users will normally have 2 of the 'level 0' branches open down to a '5th level' selected node. The users will make updates to...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.