Database Reference
In-Depth Information
This would distribute the users in the following manner:
hannu=# SELECT username, hashtext(username) & 3
as partition_nr FROM user_info;
-[ RECORD 1 ]+--------
username | bob
partition_nr | 1
-[ RECORD 2 ]+--------
username | jane
partition_nr | 2
-[ RECORD 3 ]+--------
username | tom
partition_nr | 1
-[ RECORD 4 ]+--------
username | mary
partition_nr | 3
-[ RECORD 5 ]+--------
username | jill
partition_nr | 2
-[ RECORD 6 ]+--------
username | abigail
partition_nr | 3
-[ RECORD 7 ]+--------
username | ted
partition_nr | 3
-[ RECORD 8 ]+--------
username | alfonso
partition_nr | 0
So partition 0 gets user alfonso , partition 1 bob and tom , partition 2 jane and
jill , and partition 3 gets mary , abigail , and ted . The distribution is not exactly
¼th to each partition; but as the number of partitions increase, it will be pretty close
where this actually matters.
If we had no PL/Proxy language, we could write the partitioning functions in the most
untrusted PL languages. For example, a simple login proxy function written in PL/
Pythonu looks like this:
Search WWH ::




Custom Search