Same query on a partitioned table with different date range has different execution plan

  • Query running slow .. Table has partitions based on date , some dates it return in 3 mins and some days it takes more than 3 hrs

    I have a partitioned table (partitioned by day) and have filtered stats configured.

    I am trying to run a query something like this ...

    select * from Part_tbl pt

    left join t1 join_cond

    left join t2 join_cond

    left outer join t3 join_cond

    where day_no = 09

    This is completed in 3 min for day_no = 11, 09, 08 and 07. But when I ran the same query with day_no = 10 and 12 it took 3 hours each (Data wad is not the issue as the amount of data we will get every day is almost identical). I compared the execution plans and they are different for 10/12 compared to 07/08/09/11.

    We enabled filtered stats on 01/2012 and never deleted any of the stats. Also, we have about 1250 partitions. I thought these might be the reason, but why the run time is different for only some of the partitions.

    Any help or direction would be appreciated 🙂

  • Please post table definition, index definitions and execution plan as per http://www.sqlservercentral.com/articles/SQLServerCentral/66909/

    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 2 (of 2 total)

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