sys.query_store_query question

  • All,

    My query is as follows:

    SET DATEFORMAT dmy
    SELECT p.query_id,
    DATEADD(MICROSECOND,-rs.max_duration,rs.first_execution_time) AS starttime,
    first_execution_time AS endtime, q.last_optimize_cpu_time
    FROM sys.query_store_query_text t JOIN sys.query_store_query q
    ON t.query_text_id = q.query_text_id
    INNER JOIN sys.query_store_plan p ON q.query_id = p.query_id
    INNER JOIN sys.query_store_runtime_stats rs ON rs.plan_id=p.plan_id
    WHERE OBJECT_NAME(q.object_id) = 'x'
    AND (rs.first_execution_time BETWEEN '19/01/2026 00:00:00' AND '19/01/2026 23:59:59'
    OR rs.first_execution_time BETWEEN '21/01/2026 00:00:00' AND '21/01/2026 23:59:59')

    The results are as follows:

    Optimise time

    Am I correct in understanding that:

    1) The value 957257310 in last_optimize_cpu_time indicates that SQL server took 15 minutes to optimise the query before starting to run it?

    2) The object x is a procedure. Am I correct that the optimisation would take place before any of the queries ran?

    Apologies if I missed an obvious error somewhere.

    Thanks

     

Viewing post 1 (of 1 total)

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