• ANn -425914 (2/27/2015)


    I forgot to ask:

    for indexes, does the order of column matters?

    For example I want to create an index of ID, SchoolID, on terms table.

    Does the order of the column matter in the index?

    Thanks,

    Absolutely. In your example above, the best you could get out of such an index when looking for SchoolID would be an index scan and only if you're lucky enough for SQL Server to realize that the narrow NCI would be quicker to scan than doing a clustered index scan. The column order of (especially the first column) of any index is uber important.

    --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)