Sunday, October 22, 2006

Brief Theoretical Knowledge about Table Partitioning

1. Partitioning is fully depended on Filegroups.

2. Start table partitioning as early as possible. So that huge data movement can be avoided later.

3. A file would be grouped to one and only Filegroups. Actually Filegroups improves database maintenance, performance and Online restore.

4. For your information, default Filegroup is always “primary filegroup“. If at all you don’t believe me! Create a dummy table something like this,

Create Table Test
(
sno int
)
Go

Now in your SQL Mgmt Studio, right click on that table and check the properties yourself.

5. All “System Objects” have to belong to PRIMARY Filegroup.

6. It’s recommended, to have all “User Objects” created in another Filegroup.

7. In SQL Server 2000, any user object can’t belong to more than one Filegroup. But it’s possible now in SQL Server 2005. That is, a table data can be partitioned and stored into multiple Filegroups.

8. If you have two large tables, put them into different Filegroups. Filegroups are recommended being on two different “Physical” drives.

Physical drive (hard disk) – has a spindle which has “reads per second”, “writes per second” which in turn determines the performance. While joining these 2 tables, parallel retrieval happens based on their spindle speed (since it involves two different physical drives). So there would be a boost in performance.

9. Filegroups are database specific. That is, if you create a “Filegroup1” for Database1 it won’t be available for any other databases.

10. Tables and Indexes can reside on different Filegroups.

11. Partition can be created based on the “Partition key”. Typically it would be based on the
“Date” field.

12. People querying the table need not bother about fetching records from different partition. Because SQL Engine takes care of it internally.

13. You can create separate partition for storing historic data.

14. Maintenance plan needs to be created based on the Filegroup.

15. By the way, we can set Filegroup as Read-only also. Lookup tables or tables which don’t go to change at all needs to be placed in Read-only groups. So it’s enough if we backup this Filegroup once.

16. In SQL Server 2000, we need to “Restore” all Filegroups then only we can make the database online. In SQL Server 2005, once the Primary Filegroup is up we can bring the database online. So functionality wise grouping should be done in a Filegroup.

In the next post I would talk about the steps involved in creating a partition and the different types of operations in a partition.

Technorati tags: ,

2 comments:

Anonymous said...

4. For your information, default Filegroup is always “primary filegroup“. If at all you don’t believe me! Create a dummy table something like this,

Create Table Test
(
sno int
)
Go

Alter database xyz modify filegroup abc default;

will change the default filegroup for new object creation.

Vadivel said...

Thats true. My argument holds good as long as the users haven't changed their default filegroup of installation :)