weird dbid from sys.dm_exec_query_stats

  • Hi.

    If I execute the sys.dm_exec_query_stats I get back dbids like f.e. 32512 which I can't resolve with db_name. Which database is referenced here?

    Greetz
    Query Shepherd

  • 32767, the system resource database.

    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
  • Could you explain this a bit more in detail, what the system resource db is and why it is used?

    But then I ask myself why allmost 99% have not dbid 5, as it should be? All the statments gets fired against the database having the dbid 32512?

    Greetz
    Query Shepherd

  • http://www.google.com/search?q=What+is+the+system+resource+database

    DBID 32767, no all commands do not run against it. But then, why do you think most queries in cache should have run against database 5?

    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
  • Because this is the database the statements should refer?

    Greetz
    Query Shepherd

  • Go and take a look at what the commands are that reference that hidden DB. You'll notice that there's no references to user tables, no user procedures, they'll all be system views/procedures/tables.

    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
  • Sorry gail, but this are the normal queries that should be executed on my production db pointing to this weird dbid...

    ...ah maybe this is correlated tp the sp_executesql-usage?

    Greetz
    Query Shepherd

Viewing 7 posts - 1 through 6 (of 6 total)

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