Inconsistent performance on views

  • We're running SQL Server 2008 R2 and the views in question are not indexed.

    Originally the SELECTs against the views ran less than a second.

    But, after a period of time (about 10 days), the performance on the views degrades to 50-60 seconds.

    The server is very active and the underlying tables are updated frequently;

    so there is some index fragmentation during the week but we we are doing weekly reorgs,

    and that doesn't look like the issue.

    However, IF we just recreate the view, performance returns to the sub-second range again

    - and remains there... until the next time.

    Can someone explain what may be happening?

    :unsure:

  • It sounds like you might be experiencing bad parameter sniffing... possibly. Recreating the view forces a recompile of the plan. If your statistics are aging over the week, but not enough to force a plan recompile, entirely possible, you may see the type of behavior you're seeing. Forcing a scheduled recompile on the plan is one possible solution. You could also try manually updating the statistics.

    "The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
    - Theodore Roosevelt

    Author of:
    SQL Server Execution Plans
    SQL Server Query Performance Tuning

  • Thanks, I'll see if I can hone in on the issue.

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply