• One thing that I don't quite understand...

    The last query in your article,

    ----------------------------------------------

    WITH MPAPlans

    AS (SELECT plan_handle

    , SUM(size_in_bytes) / 1024 / 8 AS numPages

    FROM sys.dm_exec_cached_plans

    GROUP BY plan_handle)

    --------------------------------------------------

    The execution plans should be mainly cached in buffer pool. So I think the CTE actually sum all the cache bytes from buffer pool and MPA. So the query result is not exactly how much space that the execution plans taking in MPA, right?