Subject Adding index befor or after filling table?
Author Kjell Rilbe

We're going to publish data from a large database into a smaller one.
Primary keys and othe rindexed values will probably be inserted in
random order.

Is it more efficient to add indexes/pk:s after the insert than before?

I recall that if indexed values are inserted in increasing order, the
index maintenance is rather efficient and perhaps even more efficient
than adding the index afterwards, but if values appear in random order...?

Also, if I add the index afterwards, will its stats be up to date
automatically, or should I issue set statistics commands for each one
after creation? (I assume it's done automatically).

Kjell Rilbe
E-post: kjell@...
Telefon: 08-761 06 55
Mobil: 0733-44 24 64