Light Yagami
Light Yagami

Reputation: 1043

Creating index takes more time than dropping in SQL

I've created an index in database in SQL:Image It took 124ms to get created.

Where when I drop that index:Image2 It took 74ms.

Why creating takes much more time than dropping?

Upvotes: 0

Views: 123

Answers (1)

gmiley
gmiley

Reputation: 6604

The simplified explanation... creating an index is more than just creating a database object. There are calculations and data copies being performed on the initial creation and any time the data in the indexed columns gets changed. Dropping an index simply releases that object and its associated data. As a result, the larger amount of data involved in the indexed columns the longer it will take to create that index.

Upvotes: 1

Related Questions