SP optimization with TVF, View

Had problem with a SP,

  1. SP has a few parameters
  2. SP unions three queries and then filter by a parameter and then return data 
  3. One of the three queries links a TVF with a few tables
  4. The TVF links a standard view with a few tables
  5. The View links several tables, however not all tables are used by the TVF
Symptom:
  • One table used by the TVF has many scan count and slows down the SP
Optimization options:
  1. Bring the parameter to the three queries referenced by the SP - no effect
  2. Modify the TVF and pass in the SP parameter - Speed up 4x
  3. Replace the view with the base table and remove unused tables - Speed up 4x





Comments

Popular posts from this blog

Project Professional 2013 Error 12015

Unable to initialize the Shared Memory listener. Access is denied