To view or not to view?

  • Generally it depedns on what is being done in the views as to whether or not is faster. Yes the undelying indexes are used (use Execution Plan view to see for yourself). Generally thou I avoid view in SPs unless I will reuse the same one each time and it only returns exactly what I need without a lot of extra joining or data thru other views.

  • I can understand that when the view is executed it would use the indexes.

    In the proc, there are plenty where clauses that referr to the columns returned by the view. Would thos use the underlying indexes?

    If so, what is the advantage of indexing a view?

    Example:

    Select * from vw_xxx

    Where

    xx = 1

    and yy = 2

    and tt = 3

    etc etc.

    Would it use the index from the table with xx column?

    Cheers,

    Crispin

    Cheers,CrispinI can't die, there are too many people who still have to meet me!It's not a bug, SQL just misunderstood me!

Viewing 2 posts - 1 through 3 (of 3 total)

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