Do database views affect query performance?

前端 未结 7 1070
栀梦
栀梦 2020-12-15 04:48

Are database views only a means to simplify the access of data or does it provide performance benefits when accessing the views as opposed to just running the query which th

相关标签:
7条回答
  • 2020-12-15 05:40

    Usually a view is just a way to create a common shorthand for defining result sets that you need frequently.

    However, there is a downside. The temptation is to add in every column you think you might need somewhere sometime when you might like to use the view. So YAGNI is violated. Not only columns, but sometimes additional outer joins get tacked on "just in case". So covering indexes might not cover any more, and the query plan may increase in complexity (and drop in efficiency).

    YAGNI is a critical concept in SQL design.

    0 讨论(0)
提交回复
热议问题