Reorganize index sql server. "There are a variety of mechanisms for rebuilding indexes. Reorganize index sql server

 
 "There are a variety of mechanisms for rebuilding indexesReorganize index sql server Reorganize all index in SQL Server

It is causing other queries to wait, even simple ones like: SELECT * FROM tableName WHERE indexedColumn = @value. Reorganize Index Log Generation Now here is the final demo of Reorganize the Index, it generates lots of Transaction Log records, a very simple demo, we will capture transaction log using sys. 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. Index fragmentation is pretty meaningless in regards to performance. . Index Rebuild vs Index Reorganize. [Test] REBUILD WITH (ONLINE = ON); Additionally, I would only rebuild indexes which require it. This removes fragmentation, reclaims disk space by. Rebuild if > 30%. Large object data is data with the image, text, ntext, varchar (max), nvarchar (max), varbinary (max), or xml data type. ALTER INDEX index_name ON table_name REORGANIZE OR. Similarly, removing. Plan B is fine. Reorganize does not holds blocking locks. Expand the Indexes folder. Er…. Expand the table on which you want to reorganize an index. There is all reason to only rebuild index that are fragmented, and a good maintenance. We want to create an index. As a general (widely accepted) rule of thumb is . In other words, zero percentage fragmentation:. If you select one database from the "Databases" dropdown list you then get the option to. I would prefer to rebuild the indexes where the fragmentation percent of the indexes is greater than 30% and a Re-org of indexes where fragmentation percent is in between 9% and 30%. A page is a small section of a database, typically an 8kb chunk. Obviously this isn't the same as index reorganize, so I'm still trying to think what does reorganize file technically mean. It is used when the operation takes a. _in_percent > 50 AND ss. After rebuilding indexes, the application performs badly. Untuk informasi selengkapnya, lihat panduan arsitektur dan desain indeks SQL Server. #1162454. You can also see if a reorganize will help until you can do a full rebuild. I'm able to rebuild all other indexes with online=on option and it won't affect performance. Cancelling / Stopping ALTER INDEX REORGANIZE. Disable the indexes on the target table (at least the non-clustered indexes, or NCIs) Insert the new data. First, since you're literally rebuilding the index, it reorders the pages and the rows on those pages. Largest table has around 500. 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. Because of this, and also the fact that in such a small index that fragmentation is typically negligable, you really should only be rebuilding indexes with a certain page threshold. TheSQLGuru (10/19/2014) Most likely cause is simply that you are reorging wth too much fragmentation. Mohamad Mahmoud Darwish. dm_exec_requests showed the REORG was only 55%. You can identify and resolve heap / index fragmentation following this guide: How to identify and resolve SQL Server Index Fragmentation. ” Select the vault database(s). It checks the SQL Server licences, if Enterprise it will rebuild the index online else it. The table at issue has 111,543,114 rows. This is typically how indexes with page level locking disabled get created. But no help, the rebuild itself not working. Use the ALTER TABLE command to rebuild the Heap. The procedure uses SQL Server ALTER INDEX command, with the REORGANIZE option NULL. index rebuild/reorganize frequency. )You need to assemble the SQL prior to calling SP_ExecuteSQL, i. allocation_units. ALTER INDEX All ON tableName REBUILD; This drops the index and recreates it, removing fragementation, reclaims disk space and reorders index pages. Should be straight forward. This job needs to be scheduled and ran on a weekly basis due to large data load. SQL Server also supports nonclustered columnstore indexes. From Rebuild or Reorganize: SQL Server Index Maintenance by Kendra Little: Short version: Rebuild: An index ‘rebuild’ creates a fresh, sparkling new structure for the index. In this case Reorganize option is selected:This is the ideal image that we can see when we first create an SQL index and after we rebuild/reorganize the index. It also lets you specify a LOB_COMPACTION option. This is great if you want to release some space quickly. One thing to ask! When I reorganize MSDB. Therefore, it'll appear as if there is still fragmentation remaining, as the housing extent will contain pages from multiple indexes. There are two options to fix fragmentation. Online & Offline Index Rebuild. 35. Basically every hour I query the dm_db_index_physical_stats dynamic management view and if an index is between 5% and 30% fragmented I. When you rebuild, SQL creates a new fresh index. Sorted by: 5. Designing the SQL Server Reorganize Index Task. . The REORGANIZE modifier for ALTER INDEX is not currently supported by Azure SQL. ALTER INDEX ALL ON [table_name] REORGANIZE; However, if you want to rebuild all the indexes on the table, you can run the following. Now that you learned how to create an index in SQL Server, it is time to undo it (only if you need to)! Learn how to drop an index in the next tutorial. @LeeWalters shrink is done, and yes, due to disk issues, not possible to add drives, that's why, in addition, db is populated with blob data, so the question is more from the index fragmentation side. Rebuild of indexes is the prime job of a DBA as heavily fragmented indexes can degrade query performance and cause your application to respond slowly. Reorganizing an Index should be done when you have elevated amounts of white space within your index (i. Starting from SQL Server 2016, new options were added to the index maintenance tasks that allow us to perform the Rebuild Index and Reorganize Index tasks, based on the fragmentation percentage of the index, and other useful options to control the index maintenance process. ALTER INDEX REORGANIZE statement is always performed online. Is this possible to do? Creating a SQL Server Maintenance Plan. For example, the heaviest index (clustered index and also pk) is running reorg for around 4 hours 30 min even do the. -Search all indexes of a table that have 5% or more of fragmentation and page_count >= 1000. As a good start, read these: Rebuild or Reorganize: SQL Server Index Maintenance (Kendra Little)“Reorganize” index option. 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. Many people (and even solutions) in the SQL Server community say you need to look at Index Fragmentation levels (e. It was trying to do so because when. 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. By default, SQL Server uses a 100% fillfactor and tries to fill up all the pages in indexes as close to full as it can. Hi, The widely used thresholds are: Reorganize if fragmentation is between 10-30%. . ApexSQL Defrag tool is a 3 rd party SQL index defragmentation tool that you can easily use to perform number of operations related to the SQL Server indexes. By allowing an index to be rebuilt dynamically, indexes enforcing either PRIMARY KEY or UNIQUE constraints can be rebuilt without having to drop and re-create those constraints. Any helps to me, please? Thanks · REORGANIZE is always an online operation, that is, it does not block. The index uses the main filters on the sales table from the time dimension, i. 3. Index rebuilds (not index reorganise) always do a fullscan update of the statistics. Reorganizing an index uses minimal system resources and is an online operation. You can also change this threshold via parameters. 3. 000 rows. Coming to update stats, I would prefer to do it with Full Scan depending on the size of the databases. If we then try to reorganize this index. Index rebuilding and reorganizing are the two methods to maintain indexes and improve database performance. In this case Reorganize option is selected: DBCC DBREINDEX rebuilds an index for a table or all indexes defined for a table. An index can become fragmented over time as data is added, updated, or deleted, and this fragmentation can lead to longer query execution times and decreased performance. Right-click Maintenance Plan and select Execute. We recently switched to Ola Hallengren's maintenance script and automated the deployment of MaintenanceSolution. The performance benefit may not be noticeable for indexes that are used primarily for seek operations. 2) Extra disk space required during SQL Server online index rebuilds. You should intelligently do index reorg and rebuilds. If you don't want to grant so granular. This means long-term blocking table locks are not held and queries or updates to the underlying table can continue during the ALTER INDEX REORGANIZE transaction. As a general (widely accepted) rule of thumb is . When you rebuild, SQL creates a new fresh index. When I run a maintenance plan to reorganize and rebuild tables indexes, it fails. For the data (clustered index and heap) you'd have to export outside SQL Server, truncate the table, shrink and then import the data. It eventually makes a Job in your server agent and then you can set a schedule or run the job manually by running this script. 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. Microsoft Certified Master: SQL Server, MVP, M. Also, running UPDATE STATISTICS gets you both index and columns stats updates. Basically, an index rebuild copies the index to another place. Bad internal fragmentation (having lots of free space on the pages) means the index is bigger than it needs to be. In this case you can perform index reorganize and index rebuild operations only on those partitions that really need it, thus making it more efficient by reducing the time and resources needed for this maintenance. There are a number of differences. (About 1 TB of data including myIndex (non-clustered)). You also can create a linked server to SQLAZURE and create a sql agent job. Still, non-clustered indexes will be left to rebuild/reorganize occasionally, but they are much smaller than table itself. Index Rebuild operation first drops and then recreates the index. First, we will start the index reorganization in a session using the following T-SQL code. you are reading your query result incorrect. Below the last two rows that displays the fail: Source: Reorganize Index Executing query "ALTER INDEX [PK_xxTableName] O. reorganize pages. And they really shouldn't be because you're using Standard Edition - and parallel index operations are an Enterprise Edition feature. You can also set a threshold so that it only considers indexes over a certain size so you're not doing unnecessary rebuilds on tiny indexes. SQL Server, MVP, M. Unlike REORGANIZE on user tables, REORGANIZE on a queue is always performed as an offline operation because page level locks are explicitly disabled on queues. I made them up. Index Reorganize During Database Full Backup. Our Production instance is running SQL Server 2014. Applies to: SQL Server SSIS Integration Runtime in Azure Data Factory The Rebuild Index task rebuilds indexes in SQL Server database tables and views. If your indexes are fragmented : If index has less than 1000 pages - do not perform any index maintenance operation. Product REBUILD GO Index Reorganize : This process physically reorganizes the leaf nodes of the index. You can apply a new fillfactor when you rebuild an index. So any insert in the middle of the key range, and likely any update too, will cause a page split and fragmentation. Product REBUILD GO Index Reorganize : This process physically reorganizes the leaf nodes of. For more information, see Data Types (Transact-SQL). REORGANIZE, or to rebuild the index using ALTER INDEX. 1. Rebuilding basically creates an entirely new copy of the index, and is much more effective at reducing fragmentation - but this comes at a cost, both in terms of time and disk space. EXEC msdb. The query processor uses statistics on your data to help determine how. some action needs to be taken to remove the ghosted records. We use SQL Server Index Rebuild and Reorganize operation to remove fragmentation level of the indexes. A nonclustered columnstore index. Backup Up Database (Full)4. . UPDATEIn this article. Over time these modifications can cause the information in the index to become scattered in the database (fragmented). Factors to consider while Rebuild/Reorganize of index in SQL Server 2012. MSDB is utilized by database mail, sql. 1. Example #. @LeeWalters shrink is done, and yes, due to disk issues, not possible to add drives, that's why, in addition, db is populated with blob data, so the question is more from the index fragmentation side. I'm able to rebuild all other indexes with online=on option and it won't affect performance. The Reorganize Index task reorganizes all indexes, regardless of fragmentation level. RDS for SQL Server doesn't have maintenance plans that automatically create plans and jobs to rebuild or reorganize indexes. ALTER INDEX [PK_SalesOrderDetailEnlarged_SalesOrderID_SalesOrderDetailID] ON [Sales]. Larger indexes have more intermediate levels and pages. – variable. Shrink File. For a turnkey solution, you may refer to Microsoft MVP Ola Hallengren's SQL Server Index and Statistics Maintenance. #969726. Index fragmentation problem after disabling page-level locking for an Index. The possibility to. Hi, We have SQL Server 2005 EE 62 bit with SP3. The first rebuilds a single index on a table and the second rebuilds all the indexes on the table. A SQL Server DBA myth a day: (29/30) fixing heap fragmentation. Speaking for SQL Server, I tend to choose a index size and index fragmentation level at which point I begin performing index maintenance. This will invoke the Tuple Mover , which will turn closed delta stores into compressed rowgroups. For more information, see Data Types (Transact-SQL). In the New Maintenance Plan dialog box, in the Name box, type a name for the plan and select OK. Once you select that option it will bring up the following screen. A few thing to consider: Can you insert the data in the order of the index? This will reduce fragmentation. 2,057 11 22. Connection. Create a execute sql task and schedule it through sql agent . Check total_pages in sys. The link points to SQL Server 2014 docs, but the syntax should work on 2005 and 2008 as well. You can read more on rebuilding indexes here . Additionally, after reorganizing indexes it is reasonable to update the statistics as this operation does not update the statistics like the index rebuild operation. The harder but much more. Add a comment. Online rebuilds are online available on the Enterprise version of SQL Server and your version probably isn't, so just set the operation not to be run "Online" on you Wizard. T-SQL Alter Index. To create a new maintenance plan, right click on Maintenance Plan and select New Maintenance Plan and the following window will open. g. ALTER INDEX [PK_SalesOrderDetailEnlarged_SalesOrderID_SalesOrderDetailID] ON [Sales]. [MyHugeTable] ADD CONSTRAINT [MyHugeTable_pk] PRIMARY KEY. Here's another script to add to the list. line is helpful to give the user some indication of what indexes it is rebuilding and how far it has progressed. e. GO. Clean Up History. WITH (ONLINE=ON). SQL Server ALTER INDEX Syntax. But if you want your script to work you would have to go to index right click select properties and enable row level locking for reorganize to work this is the only optionHello, We are running SQL 2005 and I just looked over my tables indexes, and most of the indexes were very fragmented. dbForge Index Manager for SQL Server will. The index it is running against is 78% fragmented. 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. The problem is that the size is getting out of control, I can see up to 99% fragmentation in the Primary Key clustered indexes. I am a new DBA to a SQL 2005 production Report server. The page swapping can CRUSH you (and the tlog and data files with writes) when you have. The Reorganize Index task encapsulates the Transact-SQL ALTER INDEX statement. Defragmentation in Practice. Note that the time it takes to complete the operations depends on the size of the database and how fragmented the indexes. It gives you better advantage when tempdb is. If you truly want to REBUILD, and you want to do it for ALL indexes on a given table, then the command would be (straight from the official docs that npe pointed you at): For more instructions see the official docs. Since we are facing huge performance problem we have scheduled this Rebuild index task. Thanks for your reply. インデックスの断片化の状態がわかったら、それによってインデックス (index) を再構成 (Reorganize)するか、または再構築 (Rebuild) するか決定します。. If you specify the hint. If it's a rebuild, it'll have to roll back, which is single threaded, and may take a very long time. Answers. As visible in the above image, REBUILD and REORGANIZE are the two available choices to play out the trim operation over the page. And that frequency can be lowered by using carefully selected fill factor. Therefore you do not need to update statistics OR reorganize an index if it gets rebuilt. Yes. So let’s take one thing at a time. below line will remove the NULL value from the query. A developer coming onto a project with out of date tools is a common cause of this. Create an agent WMI alert ('Reorganize Relief Valve') on a performance condition. in this instance you can avoid re-inventing the wheel by making use of sql-server-index-and-statistics-maintenance – Stu. That can be found using the STATS_DATE function. 1. You have two maintenance commands for indexes: Reorganize. e check fragmentation and take an appropriate action. A REORGANIZE physically reorders the leaf-level pages to match the logical order of the leaf nodes, whereas a REBUILD does just that, it rebuilds the index. Until now I'm using the Maintenance Plan Index rebuild task to. Shrink File is. Index rebuilding process uses more CPU and it locks the database resources. There are two ways of doing that: (i) by using the ‘ DBCC SHOWCONTIG ‘ command, and (ii) by using the ‘ sys. There are a number of differences. Rebuilding an index does two things. Expand Tables. You can also change this threshold via parameters. The issue is resolved. Okay, maybe not that. ;WITH cte AS ( SELECT object_id, index_id, partition_number, rows, ROW_NUMBER () OVER (PARTITION BY object_id, index_id, partition_number. I'm just using the reorg index task that is in the maintenance plan designer GUI. Quick explanation: An online Rebuild, rebuilds the indexes on the tempDB making it available to the queries while it is being rebuilt. ”. SIMPLE mode only means the log space is made available for reuse after a transaction is committed. From Reorganize and Rebuild Indexes. dm_exec_requests to see how much longer your query has to finish. You could also refer another query which may be helpful to you. First, let’s look at the index in this tutorial with sample code to create a non-clustered SQL Server index on a sales table. Both create/rebuild of columnstore index is an OFFLINE operation at this time but you can defragment columnstore index ONLINE. If you choose to compact large object data, the statement uses the. Since we are asking SQL Server to rebuild the clustered index on a quite large table twice, it will take a few. index_type_desc AS IndexType, indexstats. You need to do more research but basically, reorganize as often as needed to keep your fragmentation under 20-30% until you can rebuild it during off-hours. Executing this query requires the VIEW SERVER STATE permission. First, we will start with the "Maintenance Plan Wizard": The rebuild command will defragment all those intermediate pages. Rebuild the Indexes if the Fragmentation level is > 30%. Table locks alone would not make sense, the point with REORGANIZE is that the table is mainly online while the operation is running. You can slow down fragmentation by using a fill factor < 100. For more information about managing indexes, see Reorganize and Rebuild Indexes. SQL Server NULL Index. Yet, we do it at least every 2 weeks, and often times more often. Test all three and see which is fastest and which gives the least index fragmentation. Right-click the Maintenance Plans folder and select Maintenance Plan Wizard. Indexes with small number of pages (<1000) will usually. Applies to: SQL Server. 2 Answers. In order to rebuild the index SQL Server still needs a copy of the data and must reorganize the data as the index is rebuilt. record_count > 0 AND o. This is larger than the minimum row size. [Test] REBUILD WITH (ONLINE = ON); Additionally, I would only rebuild indexes which require it. This means you can grant alter table on every table of interest that already exists. The fill factor determines the amount of empty space on each page in the index, to accommodate future expansion. every 2-3 day if running maintenance once per day (night). We will call this stored procedure Maintenance. Designing the SQL Server Reorganize Index Task. Right-click the table on which the full-text index is defined, select Full-Text index, and on the Full-Text index context menu, select Properties. When you reorganize an index, SQL Server sorts the index pages and releases the unused space within the index pages. Below is an example of this technique, where the @PartitonNumber value can be changed in a restart scenario. There are two main ways to defragment a Heap Table: Create a Clustered Index and then drop it. ALTER INDEX . The Reorganize Index task encapsulates the Transact-SQL ALTER INDEX statement. Hi Team, Today when I go through some of the SQL Server performance videos, found one interesting video (Please find the link below), where he said that rebuilding indexes is a very expensive thing and it will clear the cache every time an index rebuild happens, (It means that we indirectly killing the SQL Server everything we. Msdn says: And also, avg_fragmentation_in_percent value says percentage of logical fragmentation (This is the percentage of out-of-order pages in the leaf pages of an index. NAME 'Index name', ips. CREATE INDEX IX_DisplayName ON dbo. Let’s have a look at the differences between rebuild and reorganize indexes. The syntax for rebuilding indexes is very simple, we just add the "WITH ONLINE=ON" clause to the ALTER INDEX command. Here is the image for additional clarity. This is a best practice for performance when you rebuild or reorganize indexes. 6. For example, the heaviest index (clustered index and also pk) is running reorg for around 4 hours 30 min even do the index was. This means that an index can be rebuilt without knowing the structure of a table or its. Bulk amount records are deleted and updated frequently. Using above query, you could also query the progress of backup,restore,dbcc command and so on. It is compatible with all versions of SQL Server 2005 , 2008 , 2012 , 2014 and 2016. Here is MSDN article on this: Reorganizing and Rebuilding Indexes. Here's another script to add to the list. x) implemented major performance improvements for these index operations. I want to reorganize or rebuild indexes. For a more in-depth discussion of index rebuild and maintenance in SQL Server 2014 see SQL 2014 Clustered Columnstore index rebuild and maintenance considerations Consider the two trimmed row group scenarios below:AFAIK, In the Alter index statement if we use MAXdop option it is only specific for that index operation and not applicable whenever the index is used by a query. To rebuild or reorganize indexes manually, head over to the Fragmentation tab. 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. We have experience performance issue if fragmentation is high and page count <1000. You can read more on rebuilding indexes here . If the former, you could do a shrink and then ALTER INDEX. SQL Server development version and Enterprise version has option ONLINE, which can be turned on. Frequency of the maintenance should be considered with the goal of minimizing impact of log generation. Does it mean reorganize the file contents maybe. Note: You can select “Reorganize All” to reorganize all the indexes in the table. These scripts are widely tested in the community and are much flexible so that you can. Recall the paper example from above: a rebuild would be like reprinting the document in the correct order and trashing the old ones. In SQL Server, you "might" run into issues with "updating primary key". This would also keep the original order of columns. The tool allows you to quickly collect index fragmentation statistics and detect databases that require maintenance. In the Rebuild Indexes dialog box, verify that the correct index is in the Indexes to be rebuilt grid and click OK. 11. WITH FULLSCAN Are there any advantages or disadvantages to using "UPDATE STATISTICS (Index name)" as opposed to "ALTER INDEX (index name) ON. You can add a rebuild index task or reorganize index task into the maintenance plan, but the problem is that you can't really apply any logic to the plan. File type (Data), group (PRIMARY) Name () Shrink Action = reorganize pages (=move to front), Shrink File *. If rate of Index fragmentation increased then index de-fragmentation is become required. First, we will start the index reorganization in a session using the following T-SQL code. After month the same query took up to 20-30 s. The best practice recommendation is to reorganize your index if you have 5-30% of fragmentation, and only rebuild it if it has more than 30% fragmentation. index rebuild/reorganize frequency. Paul Randal. It has an IF condition for the Reorganize but i don't need it, i need to modify the code so it queries indexes of a certain database and schema and rebuilds only if the fragmentation is bigger than 5%. For example, you can use ApexSQL Defrag to review the index usage statistics and apply the suitable. Msdn says:. DBCC DBREINDEX rebuilds an index for a table or all indexes defined for a table. The reason why too many page splits can decrease the performance of SQL Server is because of the large number of I/O operations. I have been advised by a contracted SQL Server expert that, after any change in # of CPUs and/or available memory, I should reorganize all indexes and then update all statistics or SQL Server will. Approved By Raja Jegan R Updated on October 18, 2023 Min Reading 4 Min Summary: MS SQL Server chooses not to use an index when it becomes fragmented. One option is to execute an index rebuild, which will move data around on pages. Index fragmentation increased significantly after rebuild. TEST REORGANIZE We get our open delta store again, which will cause locking. Rebuild/Reorganize working fine. Basically, rebuilding is a total rebuild of an index - it will build a new index, then drop the existing one, whereas reorganising it will simply, well. Merging the full-text index fragments can improve performance and free up disk and memory resources. column_name DISABLE; ALTER INDEX. dm_db_index_physical_stats (NULL, NULL, NULL, NULL, NULL); GO. Hallengren website has an option to reorganize indexes say with 5% Fragmentation, and rebuild for 30% Fragmentation. در این مقاله چگونگی reorganize و rebuild کردن ایندکس‌ تکه تکه شده (Fragmented Index) در SQL Server 2014 با استفاده از محیط SSMS یا SQL Server Management Studio و T-SQL یا Transact-SQL شرح داده خواهد شد. The transaction log backup size spikes during index reorganize - exponentially bigger. It depends. Index maintenance usually starts 3 hours before the database full backup and ends before the full backup start. In my last tip, Index Fragmentation Report in SQL Server 2005 & 2008, I discussed what fragmentation is, its different types, its performance impact and what are different methods available in SQL Server 2005 and 2008 to identify fragmentation levels. – The scripts has some cool features like. . [myTable] REORGANIZE WITH ( LOB_COMPACTION = ON ) I have the above query running for 16 days (still running), the table is a dummy table used for benchmark tests, it has over 10 Billion rows. Select Maximum degree of parallelism, and then enter some value between 1. The syntax for rebuilding indexes is very simple, we just add the "WITH ONLINE=ON" clause to the ALTER INDEX command. That can be found using the STATS_DATE function. Oct 6, 2022 at 14:56 "I want to reorganize or. Expand the Management folder. Update Statistics. This topic describes how to reorganize or rebuild a fragmented index in SQL Server 2017 by using SQL Server Management Studio or Transact-SQL. This makes it more likely that some other session is blocked by your session, and that you may, in turn, become blocked by a lock held by that session. As a result of rebuilding an index, SQL Server also updates the statistics for the indexes that were rebuilt.