User Tools

Site Tools


partitioningtable

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
partitioningtable [2025/03/28 12:03] jwanpartitioningtable [2025/10/10 10:15] (current) – external edit 127.0.0.1
Line 43: Line 43:
     PARTITION p_2023 VALUES LESS THAN (2024),     PARTITION p_2023 VALUES LESS THAN (2024),
     PARTITION p_future VALUES LESS THAN MAXVALUE);     PARTITION p_future VALUES LESS THAN MAXVALUE);
 +</code>
 +
 +can also be partitioned by list:
 +<code>
 +    PARTITION BY LIST (customer_id) (
 +    PARTITION p_cust_1 VALUES IN (1, 2, 3),
 +    PARTITION p_cust_2 VALUES IN (4, 5, 6),
 +    PARTITION p_cust_3 VALUES IN (7, 8, 9),
 +    PARTITION p_others VALUES IN (DEFAULT));
 +</code>    
 +
 +or by name initial:
 +
 +<code>
 +    PARTITION BY RANGE COLUMNS(customer_name) (
 +    PARTITION p_a_f VALUES LESS THAN ('G'),
 +    PARTITION p_g_m VALUES LESS THAN ('N'),
 +    PARTITION p_n_s VALUES LESS THAN ('T'),
 +    PARTITION p_t_z VALUES LESS THAN (MAXVALUE));
 +</code>    
 +
 +File sizes of individual partition are not updated until they are optimized:
 +
 +<code>
 +OPTIMIZE TABLE newtable;
 </code> </code>
  
partitioningtable.1743163417.txt.gz · Last modified: (external edit)

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki