Re: [POC] hash partitioning

From: Ashutosh Bapat <ashutosh(dot)bapat(at)enterprisedb(dot)com>
To: amul sul <sulamul(at)gmail(dot)com>
Cc: Jesper Pedersen <jesper(dot)pedersen(at)redhat(dot)com>, Amit Langote <Langote_Amit_f8(at)lab(dot)ntt(dot)co(dot)jp>, Thom Brown <thom(at)linux(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, Dilip Kumar <dilipbalaut(at)gmail(dot)com>, Yugo Nagata <nagata(at)sraoss(dot)co(dot)jp>, David Steele <david(at)pgmasters(dot)net>, Greg Stark <stark(at)mit(dot)edu>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [POC] hash partitioning
Date: 2017-10-09 12:21:21
Message-ID: CAFjFpRexH08-rb2LzodCsEeVTbxRQiNuYgh7XfGJ1Gd4zg+AaQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Oct 9, 2017 at 4:44 PM, amul sul <sulamul(at)gmail(dot)com> wrote:

> 0002 few changes in partition-wise join code to support
> hash-partitioned table as well & regression tests.

+ switch (key->strategy)
+ {
+ case PARTITION_STRATEGY_HASH:
+ /*
+ * Indexes array is same as the greatest modulus.
+ * See partition_bounds_equal() for more explanation.
+ */
+ num_indexes = DatumGetInt32(src->datums[ndatums - 1][0]);
+ break;
This logic is duplicated at multiple places. I think it's time we consolidate
these changes in a function/macro and call it from the places where we have to
calculate number of indexes based on the information in partition descriptor.
Refactoring existing code might be a separate patch and then add hash
partitioning case in hash partitioning patch.

+ int dim = hash_part? 2 : partnatts;
Call the variable as natts_per_datum or just natts?

+ hash_part? true : key->parttypbyval[j],
+ key->parttyplen[j]);
parttyplen is the length of partition key attribute, whereas what you want here
is the length of type of modulus and remainder. Is that correct? Probably we
need some special handling wherever parttyplen and parttypbyval is used e.g. in
call to partition_bounds_equal() from build_joinrel_partition_info().

--
Best Wishes,
Ashutosh Bapat
EnterpriseDB Corporation
The Postgres Database Company

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alexander Korotkov 2017-10-09 12:23:29 Re: Predicate Locks for writes?
Previous Message Jeevan Chalke 2017-10-09 12:10:04 Re: Partition-wise aggregation/grouping