content_image/673818.jpg
mysql> SELECT TABLE_NAME, PARTITION_NAME, TABLE_ROWS, AVG_ROW_LENGTH, DATA_LENGTH > FROM INFORMATION_SCHEMA.PARTITIONS > WHERE TABLE_SCHEMA = ’p’ AND TABLE_NAME LIKE ’ts_’; 

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

As shown earlier in this section, you can also verify which partitions were used for storing the rows by deleting these partitions and then performing a SELECT . 

Handling of NULL with HASH and KEY partitioning. NULL  is handled somewhat differently for tables partitioned by HASH  or KEY . In these cases, any partition expression that yields a NULL  value is treated as though its return value were zero. We can verify this behavior by examining the effects on the file system of creating a table partitioned by HASH  and populating it with a record containing appropriate values. Suppose that you have a table th  (also in the p  database) created using the following statement: 

mysql> CREATE TABLE th ( -> c1 INT, -> c2 VARCHAR(20) -> ) -> PARTITION BY HASH(c1) -> PARTITIONS 2; Query OK, 0 rows affected (0.00 sec) 

The partitions belonging to this table can be viewed using the query shown here: 

mysql> SELECT TABLE_NAME,PARTITION_NAME,TABLE_ROWS,AVG_ROW_LENGTH,DATA_LENGTH > FROM INFORMATION_SCHEMA.PARTITIONS > WHERE TABLE_SCHEMA = ’p’ AND TABLE_NAME =’th’; +------------+----------------+------------+----------------+-------------+ | TABLE_NAME | PARTITION_NAME | TABLE_ROWS | AVG_ROW_LENGTH | DATA_LENGTH | +------------+----------------+------------+----------------+-------------+ | th | p0 | 0 | 0 | 0 | | th | p1 | 0 | 0 | 0 | +------------+----------------+------------+----------------+-------------+ 2 rows in set (0.00 sec) 

TABLE_ROWS  for each partition is 0. Now insert two rows into th  whose c1  column values are NULL  and 0, and verify that these rows were inserted, as shown here: 

mysql> INSERT INTO th VALUES (NULL, ’mothra’), (0, ’gigan’); Query OK, 1 row affected (0.00 sec) mysql> SELECT * FROM th; +------+---------+ | c1 | c2 | +------+---------+ | NULL | mothra | +------+---------+ | 0 | gigan | +------+---------+ 2 rows in set (0.01 sec) 

Recall that for any integer N , the value of NULL MOD N  is always NULL . For tables that are partitioned by HASH  or KEY , this result is treated for determining the correct partition as 0 . Checking the 

