Re: [HACKERS] [POC] hash partitioning

Поиск
Список
Период
Сортировка
От Greg Stark
Тема Re: [HACKERS] [POC] hash partitioning
Дата
Msg-id CAM-w4HP4a0huBkibuj-VZPE+toUZ4B992rki4v3JmBAxXFvZew@mail.gmail.com
обсуждение исходный текст
Ответ на Re: [HACKERS] [POC] hash partitioning  (amul sul <sulamul@gmail.com>)
Ответы Re: [HACKERS] [POC] hash partitioning  (amul sul <sulamul@gmail.com>)
Список pgsql-hackers
On 2 March 2017 at 13:03, amul sul <sulamul@gmail.com> wrote:
> create table foo (a integer, b text) partition by hash (a);
> create table foo1 partition of foo with (modulus 4, remainder 0);
> create table foo2 partition of foo with (modulus 8, remainder 1);  -- legal,
> modulus doesn't need to match
> create table foo3 partition of foo with (modulus 8, remainder 4);  --
> illegal, overlaps foo1


Instead of using modulus, why not just divide up the range of hash
keys using ranges? That should be just as good for a good hash
function (effectively using the high bits instead of the low bits of
the hash value). And it would mean you could reuse the machinery for
list partitioning for partition exclusion.

It also has the advantage that it's easier to see how to add more
partitions. You just split all the ranges and (and migrate the
data...). There's even the possibility of having uneven partitions if
you have a data distribution skew -- which can happen even if you have
a good hash function. In a degenerate case you could have a partition
for a single hash of a particularly common value then a reasonable
number of partitions for the remaining hash ranges.

-- 
greg



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Yugo Nagata
Дата:
Сообщение: Re: [HACKERS] [POC] hash partitioning
Следующее
От: Ashutosh Bapat
Дата:
Сообщение: Re: [HACKERS] Questions about MergeAppend