Does execution plan cache caches the usage of functions?

  • Hi,

    Does execution plan cache holds the usage of functions as well?

    Thanks.

  • I think it does,
    When I run simple query I see function is part of the results list as well


    select
      db_name(st.dbid) as database_name,
      object_name(st.objectid) as name,
      p.size_in_bytes / 1024 as size_in_kb,
      p.usecounts,
      st.text
    from sys.dm_exec_cached_plans p
    cross apply sys.dm_exec_sql_text(p.plan_handle) st

    Thanks.

  • Multi-statement and scalar functions, yes. In-line table, no, as they're more like views.

    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 3 posts - 1 through 2 (of 2 total)

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