what is the difference if we create index (at time create table or after insert data into that table ?)

  • hi all,

    can you explain me the effect of the below questions ?

    what is the difference if we create index (at time create table or after insert data into that table ?)

  • Sounds like someone's homework. What do you think the answer is?

  • It depends. What is the size of data?

    ---------------------------------------------------
    "Thare are only 10 types of people in the world:
    Those who understand binary, and those who don't."

  • Heh... I'll second the "It Depends" aspect.

    What Recovery Model is the database in?

    What kind of index are you trying to build?

    How many rows are you inserting in the initial batch of rows?

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • +1 Jeff

    Ultimately you need to test and get an idea of when it's quicker. It often does depend on how much data, and your disk I/O. Are you creating a temp table and creating the index afterwards (i.e on the fly) or are you referring to a "typical" table that could have millions of rows over time?

    ______________________________________________________________________________Never argue with an idiot; Theyll drag you down to their level and beat you with experience

  • kbhanu15 (3/26/2014)


    what is the difference if we create index (at time create table or after insert data into that table ?)

    Is this interview question?

    ---------------------------------------------------
    "Thare are only 10 types of people in the world:
    Those who understand binary, and those who don't."

Viewing 6 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic. Login to reply