views:

194

answers:

2

I have a simple question:

Scenario:

Whose Perfomance is better ?

1)

DROP INDEX -->
TRUNCATE TABLE --> 
AND THEN FILLUP DATA -->
AND THEN CREATE INDEX

2)

DROP TABLE -->
CREATE TABLE -->
FILLUP DATA-->
CREATE INDEX

I am using a table with millinos of recods. Which of these queries would suit my needs best?

+2  A: 

Between the two methods, populating the data and then creating the index will be 99% of the time it takes to do the operation, I wouldn't worry that much if truncate or drop is faster after all both are not fully logged operations

SQLMenace
Both creating an index and filling data is done on each case. So it really doesn't matter.
David Basarab
That is what I am saying also
SQLMenace
ManishKumar1980
like I said the drop or truncate statement will not use up any significant time compared to the other operations like insert and index creation
SQLMenace
If i say that --> step 1 )Drop the tableStep 2) Create table Step 3) Create Index will be better as in this case Indexes will not be fragmented pls tell me if i am wrong.
ManishKumar1980
+2  A: 

The only real answer here is to try it and see - I expect that there will be very little difference in performance.

Kragen