Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 table and index

Author  Topic 

inbs
Aged Yak Warrior

860 Posts

Posted - 2009-11-01 : 04:19:57
hi,

i have a table with 5 miliom rows, every day i delete 50K rows and insert 50K rows.
i need to get results in a few seconds. so i added a culstered index on the column OrderNumber.

Is it right to rubild the index on this talbe?

(i understand ,if i delete/insert many rows in table every day ,so it is not recommended to use index in table,because i need rebuild index on that table and it take a long time)

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2009-11-01 : 21:50:35
5 million rows is a small table, so the index should rebuild quickly. Rather than reindex it, you could try doing update stats instead.

Oh and yes it is recommended to index the table, otherwise it'll do a table scan which will take forever.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog

"Let's begin with the premise that everything you've done up until this point is wrong."
Go to Top of Page

Pradip
Starting Member

32 Posts

Posted - 2009-11-02 : 00:38:35
If your delete and insert goes in specific range of ordernumber then you can use table partition for those range which will again increase performance.

Keep index on ordernumber, let's use update stats regularly in less peak time(night hours) after you finished much insert and delete operations.

pradipjain
Go to Top of Page

inbs
Aged Yak Warrior

860 Posts

Posted - 2009-11-02 : 01:30:04
tkizer

if my table is 15M rows is still small table?and index should rebuild quickly??
Go to Top of Page
   

- Advertisement -