» Documentation » SQL Reference

Rebuild

Syntax

REBUILD TABLE table_path
REBUILD PROCEDURE procedure_path
REBUILD DATABASE database_name
REBUILD DATABASE database_name PROCEDURES
REBUILD ALL 

Description

The REBUILD TABLE command will defragment the table data on disk redistribute the rows correctly between the server instances of the cluster. table_path is either of the form database_name.table_name, or table_name where table_name is in the currently USEd database.

The REBUILD PROCEDURE command will re-cache the SQL execution plan (REWRITE DQL) of the specified procedure. procedure_path is either of the form database_name.procedure_name, or procedure_name where procedure_name is in the currently USEd database. REBUILD PROCEDURE will regenerate a DQL plan for the batch.

REBUILD DATABASE database_name will rebuild all tables and procedures of the database named.

REBUILD DATABASE database_name PROCEDURES will rebuild all procedures of the database named.

REBUILD ALL will rebuild all of the databases in the current cluster. A REBUILD ALL is implicitly called before the end of an ALTER CLUSTER command's transaction.

All REBUILD commands are completely transaction safe, creating copies of the data on the server instances and only replacing once safely rebuilt.