Skip to content
Advertisement

Performance improvement Outer Apply

I have a query which runs slower.

Order By inside the Outer Apply is very costly, is there any better way to write this query ?

Advertisement

Answer

From what I can tell in the code, you seem to be implementing a variation of lag(ignore nulls).

Here is a better way:

Also note that in many databases the “v” in vfan would suggest a view. That might be the cause of the performance issues.

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement