Search code examples
mysqldatabase-designpartitioningdatabase-partitioning

Partition By List and Range at the same time - Multiple Partitions MySQL


Is that possible in MySQL to use List and Range partitions together. Let say

  1. I have different categories and i want to put each category in "List Partition"
  2. Now each category I want to create "Range partition" due to huge amount of data daily for each category

Further, I don't want to make separate tables physically for each category

Example Query

Select * FROM table1 WHERE category_id = 1 AND dt BETWEEN 'start_date' AND 'end_date'

If We have let say thousand of categories and each day there are million of records against each category on daily basis. If we do multiple Partitions on category plus monthly(just suppose can be weekly if required) basis against each category and then we can get great benefit as for fetching specific category and its data in datetime range we look only in that partition better than looking in one partition containing Billion of rows for every category


Solution

  • I found answer myself the solution to this is "Composite Partitioning" or also known as "Sub-Partitioning"

    Here are details

    Sub-Partitioning is also supported by other DBMS too