Do I need to create a specific non-clustered index every time?

I have a database table with more than 50 million records, and to improve the search I had to create indexes without clustering, and as soon as I create them, it takes 5-10 minutes to create, so I think that in the background Sorts data by index.

So, for example, before adding an index to my search, the table was awful and time consuming, and when I added a non-clustered index, the search was quick.

But that was only when I had 50 million records.

The question is, what if I defined the index at the very beginning when creating the table before adding any data to the table? Will he give the same search results as now? or do I need to delete and recreate the index from time to time to sort the data?

I'm sorry if my question seemed stupid, I just started to study indexes, and this is a confusing topic for me.

+4
source share
4 answers

A non-clustered index stores a copy of indexed fields in a special structure optimized for search. Creating an index of 50 million records obviously takes some time.

, , , , .

, .

, " ", . .

+4

.

, (, ).

, , , , , , .

, , ( ) , , ( ) .

, . , .

+3

ola hallengren. .

,

10 30 pct, .

>= 30 pct, rebuild.

.

.

- .

http://ola.hallengren.com/

+2

, . , , , , .

, , . , , A, B E, , C D, , B E. ​​ Olla Hallengren Crafty DBA , , , .

http://www.brentozar.com/sql/index-all-about-sql-server-indexes/ SQL Server.

+1

All Articles