Partitioning Example
A logical database file can be split into several component parts called partitions, where each partition corresponds to a physical file at the file system level.
In an unpartitioned database file, all instances of a specific class are wholly contained in a single database file, commonly referred to as a map file. A map file can host instances of more than one class. Partitioning a database file allows instances of the class to be located in different partitions of a database file. A file partition is therefore a part of a database file containing a subset of instances of a single class.
In the example in this chapter, there are two related classes, Order and OrderItem, which contain sales order data. These classes are mapped to their own dedicated map file. The database went live in January 2003 and sales order data has been captured and accumulated since that date.
The following diagram shows a partitioning scheme where Order and OrderItem objects are now spread across a number of file partitions where the actual partition is determined by a date attribute. In this image, the flat disks or platters represent file partitions. Each partition stores the Order and OrderItem objects for a specific monthly period.
Most data that tends to accumulate over time is a candidate for partitioning. A typical characteristic of this kind of data is that it tends to be comprised of objects that are created, read often, and not updated. Generic examples include application audit trails, transactions, messages, and events. Specific examples include sales or orders, banking transactions, test results, meter readings, and so on.
One of the benefits to partitioning large map files is that partitions containing historical objects that are never updated and are read infrequently can be moved to a lower-cost storage solution. Individual partitions can be frozen (made read-only) and can also be taken offline indefinitely or until required by the application.
A file reorganization mechanism can convert an existing non-partitioned database file into a partitioned format, enabling partitioning schemes like the one shown in the example to be applied retroactively.