Reverse engineering the code, you can get the partition number with the following statement:
SELECT (hashtextextended('value', 8816678312871386365)::numeric + 5305509591434766563) % 8;
Replace 8 with the number of partitions and 'value'
with the string in question.
You can test the partition number with satisfies_hash_partition
. To test if 'value'
would end up in partition 6 of 8 in table tab
, you can run
SELECT satisfies_hash_partition('tab'::regclass, 8, 6, 'value'::text);
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…