Query choosing bad plan even after running sp_updatestats

  • Hi guys,

    We have an issue where one of our queries keeps on using an incorrect query plan. We have run Sp_updatestats several times but the statistics just wont update. I have tried the following as well.

    SELECT cp.plan_handle, st.[text]

    FROM sys.dm_exec_cached_plans AS cp

    CROSS APPLY sys.dm_exec_sql_text(plan_handle) AS st

    WHERE [text] LIKE N'%[plan_handle]%';

    -- Remove the specific plan from the cache using the plan handle

    DBCC FREEPROCCACHE ([plan_handle]);

    But still no success.

    Has anyone had a similar problem like this before?

    Regards

    IC

  • Can you post the query and the 'bad' execution plan?

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass

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

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