Guia de SQL Server en Español - Analizando Consultas en SQL Server

Поделиться
HTML-код
  • Опубликовано: 7 ноя 2024

Комментарии • 2

  • @yiexexos
    @yiexexos 2 года назад +7

    Gracias por la información, les adjunto la query.
    select top (50) qs.execution_count as [Contado de la ejecucion],
    (qs.total_logical_reads)*8/1024.0 as [Total de lecutras logicas (MB)],
    (qs.total_logical_reads/qs.execution_count )*8/1024.0 as [Promedio de lecutras Logicas (MB)],
    (qs.total_worker_time)/1000.0 as [Tiempo total del trabajador (ms)],
    (qs.total_worker_time/qs.execution_count)/1000.0 as [Tiempo promedio del trabajador (ms)],
    (qs.total_elapsed_time)/1000.0 as [Tiempo total elapsado (ms)],
    (qs.total_elapsed_time/qs.execution_count)/1000.0 as [Tiempo promedio elapsado (ms)],
    qs.creation_time as [Tiempo de creacion],
    t.text as [Complete Query Text],qp.query_plan as [Plan de ejecucion]
    from sys.dm_exec_query_stats as qs with (nolock)
    cross apply sys.dm_exec_sql_text(plan_handle) as t
    cross apply sys.dm_exec_query_plan (plan_handle) as qp
    where t.dbid=db_id()
    order by qs.execution_count desc option (recompile) -- consultas que corren con frecuencia
    -- order by [Total de lecutras logicas (MB)] desc option (recompile) -- consultas que hacen muchas lecturas de disco
    --order by [Promedio de lecutras Logicas (MB)] desc option (recompile) -- Promedio de lecutras logicas
    --order by [Tiempo promedio del trabajador (ms)] desc option (recompile) -- consultas que hacen mucho uso de procesador
    --order by [Tiempo total elapsado (ms)] -- consultas que corren por mas tiempo

    • @abpapete
      @abpapete 7 месяцев назад

      gracias por transcribir la consulta