MySQL Forums
Forum List  »  Partitioning

Re: Partitioning by bigint
Posted by: Mattias Jonsson
Date: September 21, 2009 03:12AM

Yes, the HASH function is just a simple modulus (by the number of partitions), so that is correct by:
select *, hex(id) as `hex`, id % 4 as hash4, id % 3 as hash3, id % 5 as hash5 from PARTITION_TEST;
id value hex hash4 hash3 hash5
11657036521603072 0 296A0351010000 0 1 2
59294524551266304 0 D2A80E51010000 0 0 4
79928586823335936 0 11BF6A051010000 0 0 1
85483353926598656 0 12FB2A851010000 0 2 1
157408967914487808 0 22F3A9F51010000 0 0 3
197222601783836672 0 2BCACE951010000 0 2 2
316376857274548224 0 463FF1351010000 0 0 4
317962988696961024 0 469A1A751010000 0 0 4
322452419227222016 0 47994C451010000 0 2 1
326402247246282752 0 4879D1D51010000 0 2 2
394283565409435648 0 578C6D051010000 0 1 3

So an other number of partitions will give you a better distribution, you can test your self by just doing a 'SELECT id % <number of parts> FROM ...'

Another thing you can try is to add LINEAR HASH instead, which is an more advanced algorithm that does not need to recreate all partitions when you add or delete one partition, but only splits one partition into two, or joins two partitions to one. (In this particular example it would give the same distribution though)

Options: ReplyQuote


Subject
Views
Written By
Posted
4872
September 17, 2009 09:34AM
2419
September 18, 2009 06:56PM
Re: Partitioning by bigint
2410
September 21, 2009 03:12AM


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.