0

We have a DB in simple recovery mode (which we want). At some point in the past, the LDF grew to be 20ish GB, and I'd like to shrink that.

However, I don't want to shrink it if some process is simply going to grow the file again. Is there a query/table/object that might help return information about transactions that caused the file to grow? Or perhaps is there a table that indicates when the file grew in the past?

Thanks!

1
  • Thanks Jeffrey -- I wasn't aware of dba stack exchange, and I agree my question is better over there. I suspect the link you provided will get me as close as possible to what I'm looking for -- thanks again!
    – zipppy
    Dec 31, 2015 at 17:32

1 Answer 1

0

Not directly. Depending on the version of SQL you have, some of the DMVs may give you a little information about hard hitting queries:

SELECT TOP 20 SUBSTRING(qt.text, (qs.statement_start_offset/2)+1, 
        ((CASE qs.statement_end_offset
          WHEN -1 THEN DATALENGTH(qt.text)
         ELSE qs.statement_end_offset
         END - qs.statement_start_offset)/2)+1), 
qs.execution_count, 
qs.total_logical_reads, qs.last_logical_reads,
qs.min_logical_reads, qs.max_logical_reads,
qs.total_elapsed_time, qs.last_elapsed_time,
qs.min_elapsed_time, qs.max_elapsed_time,
qs.last_execution_time,
qp.query_plan
FROM sys.dm_exec_query_stats qs
CROSS APPLY sys.dm_exec_sql_text(qs.sql_handle) qt
CROSS APPLY sys.dm_exec_query_plan(qs.plan_handle) qp
WHERE qt.encrypted=0
ORDER BY qs.total_logical_reads DESC

The first thing I would check is for a database maintenance plan that is doing a DBCC or Index Rebuild.