• Ed Wagner (5/29/2015)


    Sean Lange (5/29/2015)


    TJT (5/29/2015)


    Sorry, solved - small issue on my end

    No offense but if your view is like the pseudocode below your issue is only beginning. The performance of this kind of thing is shockingly awful.

    create View MyNewView as

    select *

    from MyOldView

    I saw a presentation by Jonathan Kehayias once where he showed a query plan that used views on views on views, etc and took 20-some hours to run. When he boiled it down to the 5 base tables, it ran in a few minutes. There's a serious lesson to learn from this - one that I took to heart.

    I ran into this in the real world several years ago and I broke apart the views and it ran way faster. In more recent years I have learned about how the optimizer deals with that and glad I had made the right decision then.

    That sounds like it would have been an interesting presentation.

    _______________________________________________________________

    Need help? Help us help you.

    Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.

    Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.

    Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
    Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
    Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
    Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/