Large size snapshots.notable_query_plan table for MDW database

We are facing large table size issue for snapshots.notable_query_plan table for MDW database. snapshots.notable_query_plan table is consuming 75% of total database size.

Any suggestion why it is growing so quickly.

SQL Server - 2012 SP2

Database - sysutility_mdw

Database Size - 50GB

Table - snapshots.notable_query_plan

Count - 857146

Table Size - 37GB

Retention Time - 6 Days

Orphan records in snapshots.notable_query_plan - 210

June 20th, 2015 3:51pm

You have many notable query plans?

I the value of 6 for the retention time is correct, MDW is finding over 100000 notable query plans per day. That is a lot, and it makes me suspect that you have a bad application that inlines parameter values into SQL string.

But it could also be the case the expiration is not working. I don't have the MDW installed, so I don't know exactly what's in snapshots.notable_query_plan. But if there is a date column, you should be able to tell whether expiration is working or not.

Free Windows Admin Tool Kit Click here and download it now
June 20th, 2015 5:12pm

Exipration plan does not seems to be issue here. I have checked only 206 expired orphan plans exists.

Used below query to find orphan records - https://support.microsoft.com/en-us/kb/970014

SELECT COUNT(*)
FROM snapshots.notable_query_plan AS qp 
        WHERE NOT EXISTS (
            SELECT * 
            FROM snapshots.query_stats AS qs
            WHERE qs.[sql_handle] = qp.[sql_handle] AND qs.plan_handle = qp.plan_handle 
                AND qs.plan_generation_num = qp.plan_generation_num 
                AND qs.statement_start_offset = qp.statement_start_offset 
                AND qs.statement_end_offset = qp.statement_end_offset 
                AND qs.creation_time = qp.creation_time);
June 20th, 2015 6:14pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics