What is the LDF file in SQL Server?

Viewed 191285

What is the LDF file in SQL Server? what is its purpose?

can I safely delete it? or reduce its size because sometimes it's 10x larger than the database file mdf.

5 Answers

The LDF is the transaction log. It keeps a record of everything done to the database for rollback purposes.

You do not want to delete, but you can shrink it with the dbcc shrinkfile command. You can also right-click on the database in SQL Server Management Studio and go to Tasks > Shrink.

ldf saves the log of the db, certainly doesn't saves any real data, but is very important for the proper function of the database.

You can however change the log model to the database to simple so this log does not grow too fast.

Check this for example.

Check here for reference.

Related