• Jo Pattyn (1/23/2006)


    <A href="http://www.microsoft.com/technet/abouttn/subscriptions/flash/tips/tips_042705.mspx">http://www.microsoft.com/technet/abouttn/subscriptions/flash/tips/tips_042705.mspx</A&gt;

    Trace flag 2861 causes SQL Server to cache query plans for trivial queries that have a cost of zero or close to zero. SQL Server typically won't cache plans for these trivial queries because the cost of caching the plan is higher than the cost of generating a new plan for such a simple query. Generally this design makes sense and efficiently manages compilation.

    However, some people like to use the fn_get_sql() function to see what queries are running on a server, but fn_get_sql() can't see queries associated with the zero-cost plans unless you enable trace flag 2861.

    Thanx, that helped.

    Thanks & Best Regards,
    Hany Helmy
    SQL Server Database Consultant