Skip to main content

Posts

Showing posts with the label reindex database

Re-indexes all the tables using DBCC BREINDEX command

Summary: re-indexes all the tables using DBCC BREINDEX command. This goes and re-indexes all the tables and takes about 7 minutes and make an improvement of 10% Details: USE DbName_1 --Enter the name of the database you want to reindex totally DECLARE @TableName varchar(255)  DECLARE TableCursor CURSOR FOR  SELECT YourTableName FROM information_schema.tables  WHERE table_type = 'base table'  OPEN TableCursor  FETCH NEXT FROM TableCursor INTO @TableName  WHILE @@FETCH_STATUS = 0  BEGIN  DBCC DBREINDEX(@TableName,' ',100)  FETCH NEXT FROM TableCursor INTO @TableName  END  CLOSE TableCursor  DEALLOCATE TableCursor ReIndexing All Database Tables at once in SQL Database Server This is a simple three line command for Re-indexing All Database Tables at once in SQL Database Server. This command is very helpful to improve your database performance by re indexing tables. Its Update Statistics on Tables. USE YouDatabaseName GO EXEC sp_MSforeachtable @co

Index rebuilding in SQL

When index are rebuild that means the old indexes on the table are dropped and new indexes on the table are created. Due to the creation of the indexes on the table all the data is organised in the leaf level (cluster index) and organised simultaneously. Thus maximum the number of rows in your table , maximum will be the page count and maximum will be the time taken in rebuilding the index. Indexing is nothing but ordering of pages, thus it depends on page count

Command to reindiex,update statistics, database tables in sql through query analyzer

Write this command in query editor then run the command to reindex database use yourdatabase dbcc dbreindex('DBNM') Then use this command to update statistics of database update statistics 'DBNM' Command to reindex table DBCC DBREINDEX(YourTableName, '', 80) or DBCC DBREINDEX(YourTableName, '', 70)