Physical Design   «Prev  Next»

Lesson 9The downside to Horizontal Partitioning
ObjectiveDescribe the trade-offs that occur with Horizontal Partitioning

Disadvantages of Horizontal Partitioning

Horizontal partitioning in database design provides several benefits, such as improved performance, scalability, and manageability. However, implementing this technique also involves trade-offs that need to be carefully considered. The primary trade-offs associated with horizontal partitioning are as follows:
  1. Complexity: Implementing horizontal partitioning increases the complexity of the database system. Managing multiple partitions requires additional administration efforts, and the application logic may need to be adapted to handle data distribution and partition-aware queries. This complexity can lead to higher development and maintenance costs.
  2. Data distribution: Choosing an appropriate partition key is crucial for ensuring an even distribution of data across partitions. Uneven data distribution, or data skew, can lead to imbalanced workloads and suboptimal performance, negating the benefits of partitioning. Finding the right partition key can be challenging, especially when the data distribution changes over time.
  3. Cross-partition queries: Queries that involve multiple partitions can suffer from performance degradation. Join operations, aggregation, and sorting across partitions may require additional processing overhead and can be more complex to optimize. Consequently, partition-aware query design and optimization are essential to minimize the impact on performance.
  4. Data consistency and integrity: In distributed systems, horizontal partitioning can introduce challenges related to data consistency and integrity. Ensuring data consistency across multiple partitions and nodes may require implementing complex synchronization and conflict resolution mechanisms. Additionally, enforcing data integrity constraints, such as foreign key relationships, can become more challenging with partitioned data.
  5. Migration and repartitioning: Changes in data distribution or application requirements may necessitate repartitioning the data. Migrating or redistributing data across partitions can be a time-consuming and resource-intensive process, potentially impacting system performance and availability.
  6. Vendor lock-in: Some database management systems (DBMS) provide native support for horizontal partitioning, while others may require third-party tools or custom solutions. Relying on proprietary partitioning features can lead to vendor lock-in, making it more difficult to switch to a different DBMS in the future.
  7. Backup and recovery: While partitioning can simplify backup and recovery processes by allowing operations on smaller data subsets, it can also introduce challenges. Ensuring consistent backups across multiple partitions and nodes may require additional coordination and planning. Moreover, recovering data from a specific partition may necessitate restoring other related partitions to maintain data consistency and integrity.

Horizontal partitioning in database design presents several trade-offs that must be carefully weighed against its benefits. Increased complexity, data distribution challenges, cross-partition query performance, and data consistency issues are among the primary concerns. Thorough planning, careful partition key selection, and partition-aware application design can help mitigate these trade-offs and maximize the advantages.

Splitting table records into two or more tables reduces the amount of data the RDBMS must work through in most searches and joins. The drawback of horizontally partitioning a table is that if the RDBMS must search every row in the table (to find, for example, the total of all orders to a given distributor), then the RDBMS must search each table for appropriate records. Because the RDBMS must
  1. open one table,
  2. find all appropriate records,
  3. close the table,
  4. find and open the next table,
  5. find all appropriate records,
and so on until every record has been searched, the search will take much longer than if the table was in one piece.
The only way to determine if horizontal partitioning[1] will improve database performance is to analyze usage patterns. If users rely more on one identifiable set of rows than another, it may be worthwhile to partition the table horizontally where the rows appear to allow faster access.

Characteristics of Partitioned Tables

A partitioned table stores different records in different locations, possibly on different hard disks or even different computers. If your typical queries normally divide the data along partition boundaries, the separate partitions can operate more or less independently. You may even be able to back up different partitions separately, improving performance. In a variation on partitioning, you use multiple databases to handle different parts of the data. For example, you might have different databases to handle customers in different states or time zones. Because the databases operate independently, they are smaller and faster, and you can back them up separately. You can extract data into a data warehouse to perform queries that involve more than one database.

[1]Horizontal partitioning: Distributing the tuples of a relation across a number of (smaller) relations.

SEMrush Software