Data and Log file
In a database management system, data files & log files both are used for different purposes.
The structure of the data file & log file is also different.
Data files: Data files are physical files that are located on a disk or on the network to share & keep actual data.
Data files contain tables, indexes, views, stored procedures, and other objects.
A database may have one or more than one data file.
A database may have one or more than one filegroup.
A file group is a collection of one or more than one data file.
Internally, the data file contains multiple pages.
As per Microsoft(MS), place data files & log files on separate drives to get better performance.
1) Primary Data Files:-
The system creates this type of file for a database.MDF extension.
2) Secondary Data Files:-
This type of file is optional & is also used to store data.
We can create/add more than one secondary data file in a database that has.NDF extension.
Log Files: Although they have a distinct structure, log files are still physical files.
The log file has the.LDF file extension.
The history of every transaction that has been carried out for the database is kept in the log file.
records all inserts, updates, deletions, backups, schema modifications, etc.
Moreover, it guarantees data consistency and offers a means of recovering from system errors.
Transaction history is sequentially stored in the log file.
A database can have several log files added to it.
No comments:
Post a Comment