Partition Management SQL Commands
While a user do not need to create partitions on a table, MariaDB ColumnStore automatically creates logical partition across every columns. MariaDB ColumnStore allows to view partition information as well as disable or drop partitions. Caution should be used when disabling or dropping partitions as these commands as they are destructive. There are 2 ways to manage the partitions:
- Column Value
- Partition Number
Display Partition Information by ColumnValue
A pre-built stored function calShowPartitionsbyValue is provided with MariaDB ColumnStore to display the partition information for a particular column
The syntax for the function is
select calShowPartitionsByValue('tbl_name','col_name', 'start_value', 'end_value');
Only casual partition column types (INTEGER, DECIMAL, DATE, DATETIME, CHAR up to 8 bytes and VARCHAR up to 7 bytes) are supported with these 'value' partition functions.
The function returns list of partitions whose minimum and maximum values fall completely within the range of 'start_value' and 'end_value'
Example: select calShowPartitionsByValue('orders','orderdate', '1992-01-01', '2010-07-24'); +----------------------------------------------------------------+ |calShowPartitionsbyvalue('orders','orderdate', '1992-01-02', '2010-07-24')| +----------------------------------------------------------------+ | Part# Min Max Status 0.0.1 1992-01-01 1998-08-02 Enabled 0.1.2 1998-08-03 2004-05-15 Enabled 0.2.3 2004-05-16 2010-07-24 Enabled | +----------------------------------------------------------------+ 1 row in set (0.05 sec)