Why does putting a WHERE clause outside view have terrible performance

前端 未结 5 1206
萌比男神i
萌比男神i 2021-02-12 21:00

Let\'s say you have a view:

CREATE VIEW dbo.v_SomeJoinedTables AS
SELECT
    a.date,
    a.Col1,
    b.Col2,
    DENSE_RANK() 
      OVER(PARTITION BY a.date, a.         


        
5条回答
  •  感情败类
    2021-02-12 21:14

    the OVER() syntax was brand-new in SS2005 and apparently not well integrated into the optimizer. I suggest you try a more traditional expression? Probably NOT an expression if you care about optimizability.

    http://www.sqlteam.com/article/sql-sever-2005-using-over-with-aggregate-functions

    Or, better, get a bit more familiar with the profiler - the view should be fixable.

提交回复
热议问题