In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly introduces "how to use SQL Server database file group", in daily operation, I believe many people in how to use SQL Server database file group problems have doubts, Xiaobian consulted all kinds of information, sorted out simple and easy to use operation methods, hope to answer "how to use SQL Server database file group" doubts helpful! Next, please follow the small series to learn together!
1. Database file group concept
Database files are organized into logical groups called filegroups. A filegroup is the destination container for objects created, such as tables or indexes, whose data is scattered among the files in the destination filegroup, and which controls the physical location of the objects in the way you want.
Each database has a primary filegroup. A primary filegroup contains primary data files and all secondary files that are not placed in other filegroups. Users can create custom file groups to group data files together for subsequent management, data distribution, and placement.
2. Working mechanism of document group
File groups use a proportional population policy for all files within the group. When writing data to a filegroup, the database engine writes a percentage of the data to each file in the filegroup based on the amount of space available in the file, rather than filling the first file with all the data and then writing to the next file. For example, if file 1 has 100MB of free space, file2 has 200 MB of free space, one extent is allocated from file f1, two from file f2, and so on. In this way, both files fill almost simultaneously.
If the database is set to auto-grow, as soon as all files in the filegroup are full, the database engine automatically expands one file at a time in a circular fashion to accommodate more data.
3. The role of database file groups
Improve database performance: Allow databases to be created across multiple disks, multiple disk controllers, or RAID (Redundant Array of Independent Disks) systems. When data is accessed, multiple read/write heads can access data simultaneously and in parallel. This speeds up database operations.
Tables can be created in specific filegroups: all I/O for a particular table can be directed to a specific disk, depending on the needs of the business. This improves database performance.
4. Design principles of database file group
A database file or filegroup cannot be used by multiple databases.
A database file can belong to only one filegroup.
Data and transaction log information cannot be placed in the same file or filegroup.
Transaction log files cannot belong to any filegroup.
5. Suggestions on the use of database file groups
In general, databases perform well with only a single data file and a single transaction log file.
If you are using multiple database files, you should create a second filegroup for additional database files and set it as the default filegroup. This way, the master file will contain only system tables and objects.
To maximize performance, you need to create files or filegroups on as many different local physical disks as possible. Place the most competitive objects for disk space in different file groups
Use file groups to place objects on specific physical disks.
Place different tables used in the same linked query in different filegroups. Database performance can be improved because parallel disk I/O is used to search the join data.
Place the most frequently accessed tables and the nonclustered indexes that belong to those tables in separate filegroups. If the files are on different physical disks, database performance can be improved due to parallel I/O.
Do not place transaction log files on physical disks where other files and filegroups already exist.
At this point, on the "how to use SQL Server database file group" study is over, I hope to solve everyone's doubts. Theory and practice can better match to help everyone learn, go and try it! If you want to continue learning more relevant knowledge, please continue to pay attention to the website, Xiaobian will continue to strive to bring more practical articles for everyone!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.