Different Query_id for same query (from Querystore)

  • Hi,

    Is there a reason for having different query_ids for same SP/query from Querystore.

    I understand that for each query id, there could be different plans (plan_ids), we will have an option to pin one plan for the query_id in Querystore. But for same stored procedure, there were different queryids (from sys.query_store_plan & sys.query_store_query). I wasnt able to force an execution plan.

    can anyone help me understand on how it can have multiple queryids for same query.

    • This topic was modified 2 years, 3 months ago by  cooldude001.
  • Different connection settings? (ansi nulls, ...)

  • Thanks for the reply, There's only one connection string.

    All the connections are only coming thru app and settings should be consistent for all the sessions.

    • This reply was modified 2 years, 3 months ago by  cooldude001.
  • Check all the settings as suggested. Maybe an application server is misconfigured and using different ANSI settings. Look at the query_hash values to make sure they're the same. Normal behavior, with everything being truly identical, you won't see this. So, something is off. Go and look for it. Don't assume.

    ----------------------------------------------------The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood... Theodore RooseveltThe Scary DBAAuthor of: SQL Server 2017 Query Performance Tuning, 5th Edition and SQL Server Execution Plans, 3rd EditionProduct Evangelist for Red Gate Software

Viewing 4 posts - 1 through 3 (of 3 total)

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