MySQL Forums
Forum List  »  Partitioning

Re: Using hash to partition
Posted by: Jonathan Stephens
Date: June 14, 2007 03:53PM

That's because HASH partitioning calculates the partition number as MOD(_expression_, _number_) where _number_ is the number of partitions.

Consider the following:

mysql> SELECT NOW(), DAY(NOW()), MOD(DAY(NOW()), 150);
+---------------------+------------+----------------------+
| NOW() | DAY(NOW()) | MOD(DAY(NOW()), 150) |
+---------------------+------------+----------------------+
| 2007-06-14 23:44:58 | 14 | 14 |
+---------------------+------------+----------------------+
1 row in set (0.00 sec)

Where Y > X, MOD(X, Y) will never be greater than X. So the greatest partition number, where X is the value returned by DAY(), will never be greater than 31, because DAY() never returns a value greater than 31.

Try LINEAR HASH, KEY, or LINEAR KEY, and see what happens.

Jon Stephens
MySQL Documentation Team @ Oracle

MySQL Dev Zone
MySQL Server Documentation
Oracle

Options: ReplyQuote


Subject
Views
Written By
Posted
4849
June 04, 2007 05:17AM
Re: Using hash to partition
3003
June 14, 2007 03:53PM
2811
July 04, 2007 07:09AM
2809
July 05, 2007 02:50AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.