junwei's profileRichard's footprint on ....PhotosBlogListsMore Tools Help

Blog


    April 08

    Filegroup

    The first edition of SQLServer I used is SQLServer 2000. Filegroup had existed at that time, but actually I don't start to explore this feature until these several days. Under default circumstance, the database engine would create one database data file and one log file both of which belong to the PRIMARY filegroup which is also the default filegroup if not specified. The main purpose of employing filegroup is to ease the burden of the database management typically including backup&restore activities. Filegroup usage with multiple disk drivers will gain performance improvement, for example, you have the sample table data spread accross three data file, A.ndf, B.ndf and C.ndf all of which reside in the same filegroup and have each of file reside on different disk driver. Then you will gain better I/O capacity and performance when the sample table data is accessed since the multiple disk heads will in paralle read these 3 drives. That's the reason behind the scene that employing filegroup improve performance.
    Also you possibly use filegroup when do table partition during which you first create partition function to designate the partition range, then you create partition schema use the first steps' partition function and direct the database engine that data should go to different filegroups, thirdly you corelates the schema with the concreate table.
    Go over the syntax for adding or modify filegroup(file)
    use master;
    go;
    alter testdb;
    add filegroup FG_1;
    modify filegroup FG_1 default;
    add file
    (
      name=Data1
      filename=E:\demo\fg.ndf
      size=10MB
      maxsize=500MB
      filegrowth=10MB
    ),
    (
      name=Data2
      ...
     
    ) to filegroup FG_1