sql server defrag index. Defaults to 480m (8h). sql server defrag index

 
 Defaults to 480m (8h)sql server defrag index SQL Defrag Manager offers a totally new way to identify, optimize, manage and automate SQL Server defragmentation

Just ignore the small indexes, fragmentation is irrelevant for those anyhow. Reorganize/Rebuild SQL Server database indexes using ApexSQL Defrag ApexSQL Defrag is a 3rd party tool made specifically to automatically fix index fragmentation in SQL Server databases. Everything worked fine. In Object Explorer, Expand the database that contains the table on which you want to reorganize an index. It is compatible with all versions of SQL Server 2005 , 2008 , 2012 , 2014 and 2016. It is designed specifically to overcome the compromises DBAs have to make regarding the important task of index fragmentation maintenance. indexes AS [idx] ON [ips]. With ApexSQL Defrag you can rebuild or reorganize fragmented indexes in real time, as well as create policies and apply them to multiple databases or servers. We have a Non-Clustered index on the varbinary field and our index maintenance scripts perform a REORGANIZE on this every 2-3 days. SELECT OBJECT_SCHEMA_NAME(ips. This schema modification lock blocks all other concurrent access to the table, but it is only held for a very short period of time while the old index is dropped and the statistics updated. SQL Defrag Manager is described as 'Find and Fix SQL Fragmentation' and is a Defrag tool in the development category. It can be turned on by using the in-app wizard in any version. Automate defragmentation policies to multiple databases, tables, and indexes. If not specified, all non-system databases plus msdb and model will be defragmented. Usage involves setting the following five parameters (technically, variables) at the top of the script: @DATABASE_NAME: set to whatever database you want to check for fragmented indexes. Reorganizing an index defragments the leaf level of an index by physically re-ordering pages to match the logical order. According to Microsoft guidelines, based upon index fragmentation percentage, we may choose to either REORGANIZE,. We have decided to use the following code to compute a fragmentation % for each full-text index. They are also configured from SSMS. The execute sql task should contain the index rebuild code along with stats rebuild . A starting point for you could be to run a maintenance plan against this database. Reorganize index and level of defragmentation. Enabling Fragmentation Manager. ; @dbScope specifies a database name to defrag. In this case Reorganize option is selected:Databases with no index defragmentation were an average of 5% fragmented. Double Click on one of the SQL Statements. Aaron Bertrand April 13th, 2009 SQL Server 3. Watch this video by @A_Bansal to understand index fragmentation & page splits. This can be checked using:. This job needs to be scheduled and ran on a weekly basis due to large data load. Fragmentation >=30 AND PAGES>1000 then. how to find out defragment index pages in sql server 2008 using script? 0. Summary: SharePoint Server uses SQL Server to store most of the content for the Web site and configuration settings. The. txt","contentType. Your best assistant here is our SQL Defrag feature, seamlessly integrated with dbForge Studio for SQL Server . NAME + '] ON [' + Object_name(ind. This procedure automatically chooses whether to rebuild or reorganize an index according to its fragmentation level, amongst other parameters, and update. The above query is database specific. Contact the manufacturer of the defragmentation tool to learn how files are locked and how this. This should be part of our SQL Server Maintenance jobs. Specify. Over time these indexes become fragmented so that ordered data retrieval becomes less efficient. 4 Answers. SQL Defrag Manager is a unique solution for defragmenting indexes for SQL Server. MadhuQ1: There is no good way to check for all forms of fragmentation in either the data or the secondary indexes. index_id. After Defragmentation - Once the Azure non-clustered index has been. Speaking for SQL Server, I tend to choose a index size and index fragmentation level at which point I begin performing index maintenance. Yup. Defragment on-demand and via schedules. Remarks. Paul Randal. Between 10% and 30% – defragging the index with the REORGANIZE option is recommended. It does exactly that if ON. Ignore: Fragmentation levels of 10 percent or less should not pose a performance problem, so you don’t need to do anything. x) Service Pack 2, executing DBCC CHECKDB clears the plan cache. There are several options that allow you to specify the level of. The database is using the SIMPLE recovery model. 3. How Defragmentation Improves Performance. Manually shrinking or growing files using T-SQL commands can also contribute to physical file fragmentation. Starting with SQL Server 2005 the recommended way (required starting in SQL Server Kilimanjaro) to defragment indexes is by using the ALTER INDEX statement with the. 0. Reorganize: Reorganize indexes with between 11-30 percent fragmentation. This point here is extremely important. Paul pointed out a couple of other points. An index rebuild will always build a new index, even if there’s no fragmentation. Q2: Generally you do not need to run anything for reindex/update stats. This script has been tested and will work with SQL Server 2005, SQL Server 2008, SQL Server 2008R2, SQL Server 2012, SQL Server 2014, SQL Server 2016, SQL Server 2017 and SQL Server 2019. Index Defragmentation is one of the key processes to significantly improve performance of any database. If you what you are saying is true, even. 9. We do create indexes to improve the search performance of our queries. dm_db_index_physical_stats to get information about your index fragmentation (see the avg_fragmentation_in_percent column). Expand the table on which you want to reorganize an index. With both SQL 2000 and SQL 2005 and later versions you can get the fragmentation information by using the DBCC SHOWCONTIG command. Microsoft best practice says that you should generally not do a rebuild operation unless fragmentation is over 30%. We need to identify all the indexes that are fragmented and defrag them to achieve better performance. One of the reasons for that is fragmentation. But this takes. Defragmentation utilities may lock sections of the file, preventing SQL Server from completing a read or write operation. Store the data in a temporary table, truncate the old data, and re-insert the data back. alloc_unit_type_desc FROM sys. Particularly if you are in full recovery. This article serves as a guide as to how to automate and schedule SQL Server index defragmentation, and covers three different ways of doing it. Two types of fragmentation can afflict SQL Server indexes and consequently the performance of your databases. The reason why too many page splits can decrease the performance of SQL Server is because of the large number of I/O operations. Weekly – 3% fragmented. I teach the MS 2073 class quite a bit and the course material just. Quickly find the worst impacting indexes in a color-coded dashboard. Aug 26, 2015 at 15:42. For those unfamiliar with this object, it defragments indexes in SQL Server 2005 using the ALTER INDEX command. 16. Logical consistency checking on indexes varies. Then we can use contig [Filename] as shown below to defragment. In 2016, auto update of stats have been enabled for most databases. OBJECT_ID) + '] REORGANIZE ; ' ELSE 'ALTER INDEX [' + ind. The index fragmentation is the index performance value in percentage, which can be fetched by SQL Server DMV. If you have fragmentation, you need to REBUILD or REORGANIZE. There's a general consensus that you should reorganize ("defragment") your indices as soon as index fragmentation reaches more than 5 (sometimes 10%), and you should rebuild them completely when it goes beyond 30% (at least that's the numbers I've heard advocated in a lot of places). Rebuild drops and recreates the index. This tool provides index analysis to manage index defragmentation, including rebuild and reorganize fragmented indexes . Odds are, you’re not actually making things better – you’re making them worse! I explain why in this video: Why Index Fragmentation Doesn't Matter in SQL Server. That article is in-depth and difficult to summarise in this reply, but it comes down to creating an asynchronous. avg_fragmentation_in_percent. It doesn’t work on the intermediate pages between the root and the leaf. Use the ALTER TABLE command to rebuild the Heap. On versions prior to SQL Server 2005 you can defrag standard indexes using the DBCC INDEXDEFRAG command:For a linked list (a B-tree index), than can cause SQL Server to "jump back and forth" in the database file when it read lots of pages (a scan or partial scan). The sys. We have several databases in which a large number of tables are created and dropped. August 1, 2013 at 3:52 pm. If you need more tempdb space, you can scale up the data warehouse. This should be part of our SQL Server Maintenance jobs. DON’T: Insert records with random key values. The best recommendation I have is to create your own procedure which loops through the tables of the database and runs DBCC INDEXDEFRAG. As administrators will know, identification of fragmentation and of the same are crucial elements in database . 31, the table and index data collection is enabled by default during installation. From what we can tell, SQL Server does not conduct any internal maintenance on the system base tables, meaning that they can become very fragmented over time and bloated in size. The issue was not enough contiguous free space inside the database to arrange the index consecutively. 2 (X64). name AS IndexName, qs. You can specify a location where you'd like to store the results of the stats check off indexes. Rob Sheldon tackles the subject of Index Defragmentation in SQL Server 2005 and 2008, using the sys. The wise use of indexes is a proven method of improving database performance. Coworker started REBUILD on both tables. MDF is contiguous on disk. 1. The rebuild command will defragment all those intermediate pages. DBCC INDEXDEFRAG also compacts the pages of an. I have a question about index maintenance. The wise use of indexes is a proven method of improving database performance. " ALTER INDEX MyIndex ON MyTable REORGANIZEThe more keys and included columns, the bigger the indexes get and the longer SQL Server will hold locks to insert, update, and delete data. Index names must be unique within a table or view but don't have to be unique within a database. In our previous blog post, we got to know, how to find out all fragmented indexes in a database. The "index optimize" job created by Ola's install script focuses on defragmentation, not statistics update. OBJECT_ID) AS TableName, fq. When the SQL Server service is running, all of the mdf and ldf files are considered open and thus skipped. This means every time we need to scan the index, it’ll take 10%. Internal fragmentation means there is free space inside the data pages rather than having them fully packed with row data. Columnstore Online Index Rebuilds – Columnstore indexes need more attention to maintenance. It automates the time-consuming process of finding fragmented indexes based on policies for the targeted databases. Within sql not only is there file fragmentation, but also fragmentation on the underlying objects, tables and indexes. I’m talking about the guidance which is: if an index has less than 1000 pages and is in memory, don’t bother removing fragmentation. This must. Receive email notifications for policy and. He makes the point that, by analyzing indexes effectively, you can save a lot of. USE DatabaseName –Need to Specify the User Database Name. The other thing you can do, for when you do need to defragment indexes (if for example you have deleted a large amount of data), is using SQL Server's Service Broker to set up the maintenance plan for multiple tables in a batch. Heavily fragmented Indexes - SQL Server 2005. Refer to the below links:The downside to using the Reorganize Index task is that its index defragmentation capability is not as thorough and complete as the Rebuild Index task. 0. There are several types of fragmentation that can occur. This script has been tested and will work with SQL Server 2005, SQL Server 2008, SQL Server 2008R2, SQL Server 2012, SQL Server 2014, SQL Server 2016, SQL Server 2017 and SQL Server 2019. Azure SQL Database is a PaaS solution for migrating your on-premises databases to the Azure cloud infrastructure. Paul Randal. Only indexes with > 10,000 pages will be touched. Until yesterday, we always limited the WHERE-clause: where date > '20180101'. If you have fragmentation, you need to REBUILD or REORGANIZE. Kalman Toth, SQL Server & BI Training; SQL 2008 GRAND SLAM. Use the script below to perform test inserts into this table. The following example defragments all partitions of the PK_Product_ProductID index in the. 0The Transact-SQL programming language provides DBCC statements that act as Database Console Commands for SQL Server. Reorganize indexes in a table using Transact-SQL. It’s a tool that simplifies the management of SQL Server indexes across your organization. When you purge the table, you need to rebuild the index(s) on the table which will defrag the table data. It is designed specifically to overcome the compromises DBAs have to make regarding the important task of index fragmentation maintenance. If you're looking for whenif the index was ever rebuilt, the Ola sp does have the ability to log to a table and the previous DBA hopefully utilized this feature. is_ms_shipped = 0 --Excludes any objects created as a part of SQL Server installation AND ss. Option 1: [/u] You can either perform rebuild/defrag indexes on existing box before do the full backup. SQL - defragmenting an index on a compressed table. SQL Defrag Manager is a unique SQL Server index defragmentation solution that automates the time-consuming process of finding fragmented indexes based on parameters that you define within a policy for the targeted database. You should always do some form of intelligent rebuilding - i. Share This: As the data in the database tables of Microsoft SQL Server changes, their indexes change. The length of time the rebuild takes is related to the size of the index, not the amount of fragmentation in it. 16 years ago. Remarks. Like Ola's scripts, mine only defrag indexes that need it. [name] as 'Index', indexstats. How Defragmentation Improves Performance. Requires ALTER permission on the table or view. No, there is no auto-magical defragging of indexes. SQL index fragmentation reports. name AS [IndexName] ,IPS. Greater than 30% – rebuilding the index with the REBUILD option is probably the best option. NAME + '] ON [' + Object_name(ind. Using SQL Server Managed Lock Priority for Online Index Rebuilds. Index Recommendations and ORDER BY’s. The database will be shrunk leaving it. The only way to get rid of this fragmentation is to rebuild both the non-clustered index and the clustered index. On the second pass, SQL Server swaps the next physical page (7) with the next logical page (2). Having said that, fragmented data can produce unnecessary reads thereby. While you are at it, by all means, use. Hi, The widely used thresholds are: Reorganize if fragmentation is between 10-30%. When i try to defrag them using ALTER INDEX. Here are the options that I came up with: Expand the 1st file in the PRIMARY filegroup by ~28GB (7 files x 4GB) Move the data off each of the successive files and mark them for deletion. Delete the other 7 files. Expand the specific table. Set log file to start at 1 GB. To enable the Database Rebuild Index, we could go through this path: Site > Site Maintenance > Edit the Maintenance task. 0. That can be found using the STATS_DATE function. Index names must be unique within a table or view but don't have to be unique within a database. To create a new job, right click on SQL Server Agent, select New and then Job. This can be demonstrated by small test. One of the biggest performance hits that you will see on your databases, next to not having indexes, is indexes that are very fragmented. Script to Manage SQL Server Rebuilds and Reorganize for Index Fragmentation. When the rebuild is finished, SQL Server deletes the original clustered columnstore index. Also look at defragmenting the tables and indexes using DBCC commands. SQL Server Index Defragmentation. To optimize read-only workloads on the readable secondary replicas, you may want to create indexes on the tables in the secondary databases. I have a plan that I am not sure will work: Normally defrag the partition while the service is still running until the only fragmented files are the database files. 2. You can't do online index rebuilds. MS SQL Server always updates index statistics whenever an Insertion, Updating, or Deletion activity is performed on the . Make complete backup to a different partition. In order to begin, proceed to Manage Index. Defragmentation improves disk space and. Msg 50000, Level 16, State 1, Procedure IndexOptimize, Line 1009 The documentation is available at. Indexes with small number of pages (<1000) will usually. 1. dm_db_index_physical_stats (DB_ID(), NULL, NULL,. SQL - defragmenting an index on a compressed table. set @current_sql = (select top 1 Reorganize_SQL from @fragmented_indexes) execute sp_executesql @current_sql--select. In this article, I will provide a mechanism for automating SQL Server index defragmentation implemented in a database used in the company I work for. We defrag if the index is large, otherwise reindex. page_count FROM sys. It does exactly that if ON. I've been tasked with performing defragmentation on all of the tables. The T-SQL below will shrink the data file to 3GB. Viewed 439 times. Index fragmentation can cause high CPU usage, which means disk usage, and therefore performance degradation. Try to use another defrag tool that let you defrag the free space (I use Defraggler from Piriform. This to me would be a sign that constant rebuilds of that index actually aren't a good help. For those unfamiliar with this object, it defragments indexes in SQL Server 2005 using the ALTER INDEX command. dm_db_index_physical_stats (Transact-SQL). As well as maintenance plans, SQL Server Agent jobs are also a handy way to automate and schedule index defragmentation jobs in SQL Server. SELECT CASE WHEN indexstats. Share. Find and remove unused indexes – everything that is unused doesn’t do anything good. Create a clustered index and move it away from the heap. 1. Defragment indexes on your SQL SCCM database every night. Follow. About; Products. Expand the Indexes. You need free space in the db of table_size x 1. Locking. It’s advisable to remove those often. Image is no longer available. We have a database with 2 tables, one with hundreds of millions of rows (row size<1KB), another 14 million rows. This mechanism allows defragmenting required indexes on a regular basis since index fragmentation takes place constantly in the 24/7 system. If not specified, all non-system databases plus msdb and model will be defragmented. Applies to: SQL Server Azure SQL Database Azure SQL Managed Instance SQL Server, Azure SQL Database, and Azure SQL Managed Instance support table and index partitioning. The operation only requires an intent-shared (IS) table lock. IndexOptimize uses the SQL Server ALTER INDEX command: REBUILD WITH (ONLINE = ON) to rebuild indexes online, REBUILD WITH (ONLINE = OFF) to rebuild indexes offline, and REORGANIZE to reorganize indexes. While you are at it, by all means, use FILLFACTOR, to reduce future fragmentation. Let’s say N […] How Fragmentation Hurts SQL Server Performance. From this tab, select a SQL Server instance in the server explorer on the left and choose database (s) as a target of index operation. I have a weekly process that does all of my database checks, etc. Any indexes above 50% in fragmentation percentages that affect more than 4000 rows are bad, and the system performance can significantly benefit from defragmenting the indexes. The re-inserting of the data in PK order assures that the data is well-defragmented. Microsoft recommends Index Rebuild operation to defrag indexes if the fragmentation level of your index is greater. To test this you can comment out (or remove completely) the line second from the bottom with two minus signs (--). Expand the table on which you want to reorganize an index. @tblName specifies if you only want to defrag indexes for a. Sure, the database files are still in access by the running Sql Server service, but it is possible to defrag them and it takes effect. Copy the detached database file back to the. Paul Randal. Note that PostgreSQL uses the term "clustered index" to use something vaguely similar and yet very different to SQL Server. indexes. select object_name(IPS. Speaking for SQL Server, I tend to choose a index size and index fragmentation level at which point I begin performing index maintenance. It can be done with online option in enterprise edition. Now we will see how to defrag indexes. Yes, this is due to low page count. SQL will order its data file, but that is still subject to the OS's allocation of physical space for that file. ApexSQL Defrag is an enterprise SQL Server tool which is used for monitoring, analyzing and managing SQL Server index defragmentation which works down to a single index. Those rebuilds have been causing some locking pressure on one of our apps and I am looking at the possibility of scaling the rebuilds. As data is added to the table, the free space fills because the fill factor isn't maintained. Sorted by: 2. Logical fragmentation happens when an index leaf page is full and space is required on it, either for an insert or to make an existing record longer (from updating a variable-length column). 25. Note that the time limit is checked BEFORE an index defrag begins, thus a long index defrag can exceed the time limit. Bad internal fragmentation (having lots of free space on the pages) means the index is bigger than it needs to be. Its wide range of features allows users to create and. Defragment on-demand and via schedules. [name] , ips. A. List the Indexes. SQL Server Agent job alert configuration. Often, this is not enough to perform index. INSERT INTO [dbo]. [index_id] , idx. The indexes are left as they were at the time of backup. Enter a Name and Description for the agent job, and then select OK. Columnstore Online Index Rebuilds – Columnstore indexes need more attention to maintenance. Fortunately, like Windows 7, Server 2008 can on a schedule defrag. Chad Boyd. One of the biggest performance hits that you will see on your databases, next to not having indexes, is indexes that are very fragmented. Between 10% and 30% – defragging the index with the REORGANIZE option is recommended. The minimum permission to create/alter index can be easily found in corresponding BOL articles CREATE INDEX (Transact-SQL) and ALTER INDEX (Transact-SQL):. This had a negligible impact. This tool provides index analysis to manage index defragmentation, including rebuild and reorganize fragmented indexes . Applies to: SQL Server Azure SQL Database Azure SQL Managed Instance Azure Synapse Analytics Analytics Platform System (PDW) Columnstore indexes are the standard for storing and querying large data warehousing fact tables. Even though it should be safe, I would not want to defrag disks in Production while SQL is running. It appears to be a bug in 2012 R2. Now understand that logical fragmentation is not introduction of free space or some kind of space between rows present in index. Review Index Fragmentation Report in SQL Server 2005 and 2008 tip. The operation only requires an intent-shared (IS) table lock. 0. Demo on impact of fragmentation while using non-clustered index on GUID primary key. dm_db_index_physical_stats ) function accepts parameters such as the database, database table, and index for which you want to find fragmentation. Delete the database with fragmented MDF file. This should not be a problem. The other thing you can do, for when you do need to defragment indexes (if for example you have deleted a large amount of data), is using SQL Server's Service Broker to set up the maintenance plan for multiple tables in a batch. Defragmenting an Index. If only table_id is specified or if index_id is 0, the data pages of the specified table are scanned. Maintenance. Database size was ~66GB. Because the smallest unit of data to be cached is an 8 kB data page, not a single row, it also. Index Rebuild vs Index Reorganize. avg_fragmentation_in_percent as Fragmentation, indexstats. The issue was not enough contiguous free space inside the database to arrange the index consecutively. Similar to its clustered index counterpart, the index key columns are stored in a B-tree structure except in this case the actual data is not stored in the leaf nodes. The sys. Any full-text indexes of non-trivial size with fragmentation of at least 10% will be flagged to be re-built by our over-night maintenance. The Ultimate Index Width Stats Reporter. Often, this is not enough to. 2. I know that there are really three kinds of fragmentation that I need to be concerned about as a DBA: Index Fragmentation in the SQL data files, including clustered index (table) fragmentation. The SYS. It creates a thread that runs periodically to detect when the database has more than 25% free disk space allocated to it. Larger indexes have more intermediate levels and pages. alter index ci on t_ci reorganize -- measure the fragementation select avg_fragmentation_in_percent, avg_fragment_size_in_pages, fragment_count, avg_page_space_used_in_percentAWS Improving database optimization doc article provides information about Rebuild Indexes and Update Statistics. Apart from disk space you should not be too worried. However, over time and especially when heavy. Open-file defragmenting affects performance. To improve the clustering of pages, rebuild the index. You need free space in the. Check the comment header block for its documentation. Starting Price: $1,196 per. . For maintenance purposes, you can use Azure Automation and create a recurring script that checks for fragmented indexes and optimizes it. You have the option LOB_COMPACTION. If you have a clustered index on the table the fastest way to defragmanet your table would be to drop and recreate the clustered index. 25. Let it autogrow with at least 200 MB at the time. @tblName specifies if you only want to defrag indexes for a specific table. But only if the index is bigger than a small-thing (I forget exactly, but some really small tables appeared frag'd immediatly after reindex), and is more than 20% fragmentated. From this tab, select a SQL Server instance in the server explorer on the left and choose database (s) as a target of index operation. @operation: {all, index, statistics} (no default) statistics : will run only statistics update. avg_fragmentation_in_percent, ips. This REBUILD option is available in SQL Server 2008 onwards. Veritas now uses the heavily debated command DBCC SHOWCONTIG WITH ALL_INDEXES,or DBCC SHOWCONTIG WITH ALL_INDEXES,tableresults (Table results will give you a table format to read) to monitor the health of the table indexes when the use of the sys. index. Watch this video by @A_Bansal to understand index fragmentation & page splits. In fact, once you start focusing on defragmentation at the SQL Server level – whether with manual defragmentation or with the automated defragmentation provided with SQL Defrag Manager, you may decide Database Index Defragmentation Tool for SQL Server. If not specified, all non-system databases plus msdb and model will be defragmented. 9bn row table which has a varbinary (255) column which we use to store the HashBytes of an nvarchar (2000) field in the same table. if the index has: less than 5% logical fragmentation, don’t do anything. SQL. [object_id] AND [ips]. You can't do online index rebuilds. Fragmentation. Let’s use DBCC SHRINKDATABASE to reclaim the empty space. As of version 2020. We can see after the command there are only 4 fragments. The first method is the Fragmentation page of the SQL Server Index Properties window. There needs to be an automated Index defragmentation job that will either reorganize or rebuild the indexes based on the fragmentation level for a specific table in a specific database. Indexes play a critical role in SQL Server query performance. Because you cannot make schema or data changes on the secondary databases, create indexes in the primary databases and allow the changes to transfer to the secondary database through. After running your script in SQL 2005 I still don’t see any index defrag changes not with a 3-rd party monitoring tool or by running this: USE master SELECT * FROM. This new DMF ( sys. If your table has a clustered index, the state of the index reflects the state of the table. Here are the changes: Added support for database and object names with special characters. For this example, the defragmentation reduces the size of the index by more than 3x (from 25 pages to 7 pages) and the table consumes just over 50% less space. Here is a simple query to check fragmentation on your existing indexes:From SQL Server Books Online: "REORGANIZE:Specifies the index leaf level will be reorganized. Two additional methods to defragment physical database and log files are backup/restore or detach-move-attach, and both require down-time. It makes your indexes larger and many operations slower by making the SQL Server access more pages than necessary. Niko Neugebaeur is the go-to for in-depth columnstore tips, and in this post, he analyzes the online. A starting point could be looking at the queries being executed on your server. Fragmented indexes will primarily slow down ‘search’ performance. We need to drag and drop tasks from the Toolbox (to open the toolbox use Ctrl + Alt + X) into the gray workspace area on the bottom as shown in the below screenshot. g. 1. Maintenance. Results still shows high fragmentation, even the application is only used for 2 to 3 days after defragmentation. Create/restore new database from the recently created backup. MyTable REBUILD. Index Defragmentation is one of the key processes to significantly improve performance of any database.