content_image/784053.jpg content_image/784065.jpg
PARTITION BY RANGE COLUMNS(a, b) ( PARTITION p0 VALUES LESS THAN (5, 12), PARTITION p3 VALUES LESS THAN (MAXVALUE, MAXVALUE) ); 

If we insert exactly the same rows into rc1  as we just inserted into r1 , the distribution of the rows is quite different: 

mysql> INSERT INTO rc1 VALUES (5,10), (5,11), (5,12); Query OK, 3 rows affected (0.00 sec) Records: 3 Duplicates: 0 Warnings: 0 mysql> SELECT PARTITION_NAME,TABLE_ROWS -> FROM INFORMATION_SCHEMA.PARTITIONS -> WHERE TABLE_NAME = ’rc1’; 

<img src='content_image/784053.jpg'>

2 rows in set (0.00 sec) 

This is because we are comparing rows rather than scalar values. We can compare the row values inserted with the limiting row value from the VALUES THAN LESS THAN  clause used to define partition p0 in table rc1 , like this: 

mysql> SELECT (5,10) < (5,12), (5,11) < (5,12), (5,12) < (5,12); 

<img src='content_image/784065.jpg'>

1 row in set (0.00 sec) 

The 2 tuples (5,10)  and (5,11)  evaluate as less than (5,12) , so they are stored in partition p0 . Since 5 is not less than 5 and 12 is not less than 12, (5,12)  is considered not less than (5,12) , and is stored in partition p1 . 

The SELECT  statement in the preceding example could also have been written using explicit row constructors, like this: 

SELECT ROW(5,10) < ROW(5,12), ROW(5,11) < ROW(5,12), ROW(5,12) < ROW(5,12); 

For more information about the use of row constructors in MySQL, see Section 13.2.11.5, “Row Subqueries” . 

For a table partitioned by RANGE COLUMNS  using only a single partitioning column, the storing of rows in partitions is the same as that of an equivalent table that is partitioned by RANGE . The following CREATE TABLE  statement creates a table partitioned by RANGE COLUMNS  using 1 partitioning column: 

CREATE TABLE rx ( a INT, b INT ) PARTITION BY RANGE COLUMNS (a) ( PARTITION p0 VALUES LESS THAN (5), PARTITION p1 VALUES LESS THAN (MAXVALUE) ); 

If we insert the rows (5,10) , (5,11) , and (5,12)  into this table, we can see that their placement is the same as it is for the table r  we created and populated earlier: 

mysql> INSERT INTO rx VALUES (5,10), (5,11), (5,12); Query OK, 3 rows affected (0.00 sec) 

