EddieIT
asked on
SQL table looses indexes after import of large data, re-indexing script needs to be executed
Hello Experts, I use SQL DTS package to import into multiple tables for product information, after large imports my database gets slow untill I do not run a re-indexing script. How can I check properly if the table needs to be re-indexed or not?
ASKER
Thank you, but how can I run it on a specific table / database?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I did that, but I got a statement error
SELECT *
FROM sys.dm_db_index_physical_s tats ( DB_ID('<V2K_SuitSupply_Ind exTest>'), OBJECT_ID('dbo.tblProduct' ), NULL, NULL, NULL )
SELECT *
FROM sys.dm_db_index_physical_s
Assuming "V2K_SuitSupply_IndexTest" is the DB name:
SELECT *
FROM sys.dm_db_index_physical_s tats ( DB_ID('V2K_SuitSupply_Inde xTest'), OBJECT_ID('dbo.tblProduct' ), NULL, NULL, NULL )
SELECT *
FROM sys.dm_db_index_physical_s
ASKER
Got it, Thanks, whatis teh difference between index_Type_Desc HEAP and NONCLUSTERED INDEX
Heap implies no imposed structure to the records, so no indices at all. A non-clustered Index is one that refers out to all the records, but does not re-order them in any way. A clustered Index imposes a physical order on the records
There are two types of tables:
a HEAP, with no clustered index
a clustered index, which controls the physical order of the rows in the table [a clustered index IS the table itself].
Additionally, you can add one or more nonclustered indexes to a table to speed up lookups.
A nonclustered can always be safely dropped and recreated, or rebuilt.
a HEAP, with no clustered index
a clustered index, which controls the physical order of the rows in the table [a clustered index IS the table itself].
Additionally, you can add one or more nonclustered indexes to a table to speed up lookups.
A nonclustered can always be safely dropped and recreated, or rebuilt.
USE <import_db>
SELECT *
FROM sys.dm_db_index_physical_s
If the avg_fragmentation_in_perce
If less than that, index is OK as is.