I have a table in a SQL 2005 database which is brand new. As part of our application deployment we load the table with about 2.6M rows. Once that is done, the indexes on the table are all rebuilt. Then the users are let into the system and queries against that table time out. I can then rebuild the indexes (using the same exact script that was used after the import) and the queries are lightning fast.
I've checked that there are no other major data changes to the table after the index rebuilds. Any ideas on what else might cause this behavior?
Here's a sample of what the index rebuild script looks like:
DROP INDEX dbo.My_Table.Index1
DROP INDEX dbo.My_Table.Index2
ALTER INDEX PK_My_Table ON dbo.My_Table REBUILD
CREATE NONCLUSTERED INDEX Index1 ON dbo.My_Table (column_1 ASC)
CREATE NONCLUSTERED INDEX Index2 ON dbo.My_Table (column_2 ASC)