Home » Topic » How to rebuild indexes in SQL Server Database

How to rebuild indexes in SQL Server Database

Andrew Jackson ~ Modified: October 22nd, 2015 ~ ~ 1 Minute Reading

Home Forums How to rebuild indexes in SQL Server Database

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #856 Score: 0
    Andrew Jackson
    Moderator
    1 pt

    Is there any way to rebuild or reorganize an index or all indexes on a table

    #858 Score: 0
    Stephen West
    Moderator
    4 pts

    Yes, you can do it by using SQL Server Management Studio or using T-SQL.

    #859 Score: 1
    Andrew Jackson
    Moderator
    1 pt

    Can you please tell me the procedure to rebuild indexes?

    #862 Score: 0
    Stephen West
    Moderator
    4 pts

    Execute the below query

    USE AdventureWorks2012;
    GO
    ALTER INDEX PK_Employee_BusinessEntityID ON HumanResources.Employee
    REBUILD;
    GO
    
    #871 Score: 0
    Andrew Jackson
    Moderator
    1 pt

    Can I rebuild all indexes by using this query?

    #874 Score: 0
    Stephen West
    Moderator
    4 pts

    No this query is only to rebuild a defragmented index. But you can rebuild all indexes in a table by using the following query

    USE AdventureWorks2012;
    GO
    ALTER INDEX ALL ON Production.Product
    REBUILD WITH (FILLFACTOR = 80, SORT_IN_TEMPDB = ON,
                  STATISTICS_NORECOMPUTE = ON);
    GO
    #876 Score: 0
    Lincoln Burrows
    Moderator
    16 pts

    Rebuild all indexes on a table using SQL Server Management Studio

    In Object Explorer, connect to Instance Services.. and then expand that instance
    Expand Database that contains the table with the specified indexes, then expand Tables
    Expand the table in which the indexes belong
    Right click on the Indexes and then select Rebuild All and click OK

Viewing 7 posts - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.