Does SQL Server propagate WHERE conditions in complex views?

后端 未结 3 881
眼角桃花
眼角桃花 2021-01-22 15:37

I\'ve followed this question with a full example in case it isn\'t clear what I mean from the question.

I\'ve made a view which joins data from about five tables. The t

3条回答
  •  粉色の甜心
    2021-01-22 15:51

    Generally, the optimizer will handle this with aplomb, but as the query and implied subqueries become increasingly complex, the chances that the optimizer will choose the proper execution path diminishes accordingly. This can be aggravated by having more indexes on the tables, or very similar indexes on the tables it will be examining.

    As a general rule, I try to discourage joining to views, and I strongly discourage creating views that are comprised of other views.

提交回复
热议问题