Re: Multi-Column List Partitioning

2022-01-14 Thread Julien Rouhaud
Hi, The cfbot reports some clang warning on the last version of the patchset: https://cirrus-ci.com/task/6721617647632384 [16:35:24.444] partprune.c:2775:8: error: explicitly assigning value of variable of type 'int' to itself [-Werror,-Wself-assign] [16:35:24.444] off =

Re: Multi-Column List Partitioning

2022-01-02 Thread Amul Sul
On Wed, Dec 29, 2021 at 7:26 PM Nitin Jadhav wrote: > > > > -* For range partitioning, we must only perform pruning with values > > -* for either all partition keys or a prefix thereof. > > +* For range partitioning and list partitioning, we must only > > perform > > +

Re: Multi-Column List Partitioning

2021-12-23 Thread Amul Sul
On Tue, Dec 21, 2021 at 6:34 PM Nitin Jadhav wrote: > > --- > > > + if (isnulls && isnulls[i]) > > + cmpval = 0; /* NULL "=" NULL */ > > + else > > + cmpval = 1; /* NULL ">" not-NULL */ > > + } > > + else if (isnulls && isnulls[i]

Re: Multi-Column List Partitioning

2021-12-21 Thread Amit Langote
On Tue, Dec 21, 2021 at 2:47 PM Ashutosh Sharma wrote: > On Mon, Dec 20, 2021 at 7:04 PM Amit Langote wrote: >> On Mon, Dec 13, 2021 at 11:37 PM Ashutosh Sharma >> wrote: >> > >> > Hi, >> > >> > Is this okay? >> > >> > postgres=# CREATE TABLE t1 (a int, b int) PARTITION BY LIST ( a, a, a ); >>

Re: Multi-Column List Partitioning

2021-12-20 Thread Ashutosh Sharma
On Mon, Dec 20, 2021 at 7:04 PM Amit Langote wrote: > Hi, > > On Mon, Dec 13, 2021 at 11:37 PM Ashutosh Sharma > wrote: > > > > Hi, > > > > Is this okay? > > > > postgres=# CREATE TABLE t1 (a int, b int) PARTITION BY LIST ( a, a, a ); > > CREATE TABLE > > > > postgres=# CREATE TABLE t1_1 PARTITI

Re: Multi-Column List Partitioning

2021-12-20 Thread Amit Langote
Hi, On Mon, Dec 13, 2021 at 11:37 PM Ashutosh Sharma wrote: > > Hi, > > Is this okay? > > postgres=# CREATE TABLE t1 (a int, b int) PARTITION BY LIST ( a, a, a ); > CREATE TABLE > > postgres=# CREATE TABLE t1_1 PARTITION OF t1 FOR VALUES IN ((1, 2, 3), (4, 5, > 6)); > CREATE TABLE > > postgres=#

Re: Multi-Column List Partitioning

2021-12-13 Thread Ashutosh Sharma
Hi, Is this okay? postgres=# CREATE TABLE t1 (a int, b int) PARTITION BY LIST ( a, a, a ); CREATE TABLE postgres=# CREATE TABLE t1_1 PARTITION OF t1 FOR VALUES IN ((1, 2, 3), (4, 5, 6)); CREATE TABLE postgres=# \d t1 Partitioned table "public.t1" Column | Type | Collation | Nulla

Re: Multi-Column List Partitioning

2021-12-09 Thread Amul Sul
On Thu, Dec 9, 2021 at 12:43 PM Amul Sul wrote: > > On Thu, Dec 9, 2021 at 12:03 PM Amit Langote wrote: > > > > On Thu, Dec 9, 2021 at 3:12 PM Amul Sul wrote: > > > On Thu, Dec 9, 2021 at 11:24 AM Amit Langote > > > wrote: > > > > > > > [] > > > > On Mon, Dec 6, 2021 at 10:57 PM Nitin Jadh

Re: Multi-Column List Partitioning

2021-12-08 Thread Amul Sul
On Thu, Dec 9, 2021 at 12:03 PM Amit Langote wrote: > > On Thu, Dec 9, 2021 at 3:12 PM Amul Sul wrote: > > On Thu, Dec 9, 2021 at 11:24 AM Amit Langote > > wrote: > > > > > [] > > > On Mon, Dec 6, 2021 at 10:57 PM Nitin Jadhav > > > wrote: > > > > > Looks difficult to understand at first g

Re: Multi-Column List Partitioning

2021-12-08 Thread Amit Langote
On Thu, Dec 9, 2021 at 3:12 PM Amul Sul wrote: > On Thu, Dec 9, 2021 at 11:24 AM Amit Langote wrote: > > > [] > > On Mon, Dec 6, 2021 at 10:57 PM Nitin Jadhav > > wrote: > > > > Looks difficult to understand at first glance, how about the following: > > > > > > > > if (b1->isnulls != b2->isn

Re: Multi-Column List Partitioning

2021-12-08 Thread Amul Sul
On Thu, Dec 9, 2021 at 11:24 AM Amit Langote wrote: > [] > On Mon, Dec 6, 2021 at 10:57 PM Nitin Jadhav > wrote: > > > Looks difficult to understand at first glance, how about the following: > > > > > > if (b1->isnulls != b2->isnulls) > > >return false; > > I don't think having this block

Re: Multi-Column List Partitioning

2021-12-08 Thread Amit Langote
On Thu, Dec 9, 2021 at 2:54 PM Amit Langote wrote: > > Hi Nitin, > > Was looking at warnings generated by v8: > > partbounds.c:971:17: warning: unused variable 'b1_isnull' [-Wunused-variable] > boolb1_isnull = false; >

Re: Multi-Column List Partitioning

2021-12-08 Thread Amit Langote
Hi Nitin, Was looking at warnings generated by v8: partbounds.c:971:17: warning: unused variable 'b1_isnull' [-Wunused-variable] boolb1_isnull = false; ^ partbounds.c:972:17: warning: unused variable 'b2_isnull' [

Re: Multi-Column List Partitioning

2021-12-06 Thread Amul Sul
On Mon, Dec 6, 2021 at 7:27 PM Nitin Jadhav wrote: > > Thank you for reviewing the patch. > > > partbounds.c: In function ‘get_qual_for_list.isra.18’: > > partbounds.c:4284:29: warning: ‘boundinfo’ may be used uninitialized > > in this function [-Wmaybe-uninitialized] > > datumCopy(bound_i

Re: Multi-Column List Partitioning

2021-12-03 Thread Amul Sul
Hi, Few comments for v7 patch, note that I haven't been through the previous discussion, if any of the review comments that has been already discussed & overridden, then please ignore here too: partbounds.c: In function ‘get_qual_for_list.isra.18’: partbounds.c:4284:29: warning: ‘boundinfo’ may

Re: Multi-Column List Partitioning

2021-11-02 Thread Nitin Jadhav
> I noticed that there's no commitfest entry for this. Will you please > add this to the next one? I have added it to Nov commitfest. Thanks & Regards, Nitin Jadhav On Fri, Oct 29, 2021 at 1:40 PM Amit Langote wrote: > > Hi Nitin, > > On Fri, Oct 22, 2021 at 6:48 PM Nitin Jadhav > wrote: > >

Re: Multi-Column List Partitioning

2021-10-29 Thread Amit Langote
Hi Nitin, On Fri, Oct 22, 2021 at 6:48 PM Nitin Jadhav wrote: > Thanks for sharing. I have fixed the issue in the attached patch. I noticed that there's no commitfest entry for this. Will you please add this to the next one? -- Amit Langote EDB: http://www.enterprisedb.com

Re: Multi-Column List Partitioning

2021-10-22 Thread Zhihong Yu
On Fri, Oct 22, 2021 at 3:50 AM Zhihong Yu wrote: > > > On Fri, Oct 22, 2021 at 2:48 AM Nitin Jadhav < > nitinjadhavpostg...@gmail.com> wrote: > >> > While testing further I got a crash with partition wise join enabled >> for multi-col list partitions. please find test case & stack-trace below. >

Re: Multi-Column List Partitioning

2021-10-22 Thread Zhihong Yu
On Fri, Oct 22, 2021 at 2:48 AM Nitin Jadhav wrote: > > While testing further I got a crash with partition wise join enabled for > multi-col list partitions. please find test case & stack-trace below. > > Thanks for sharing. I have fixed the issue in the attached patch. > > Thanks & Regards, > Ni

Re: Multi-Column List Partitioning

2021-10-15 Thread Amit Langote
Hi Rajkumar, On Mon, Oct 11, 2021 at 2:36 PM Rajkumar Raghuwanshi wrote: > > Thanks for the patch, it applied cleanly and fixed the reported issue. I > observed another case where > In case of multi-col list partition on the same column query is not picking > partition wise join. Is this expec

Re: Multi-Column List Partitioning

2021-10-11 Thread Rajkumar Raghuwanshi
Hi Nitin, While testing further I got a crash with partition wise join enabled for multi-col list partitions. please find test case & stack-trace below. SET enable_partitionwise_join TO on; CREATE TABLE plt1 (c varchar, d varchar) PARTITION BY LIST(c,d); CREATE TABLE plt1_p1 PARTITION OF plt1 FOR

Re: Multi-Column List Partitioning

2021-10-10 Thread Rajkumar Raghuwanshi
Thanks for the patch, it applied cleanly and fixed the reported issue. I observed another case where In case of multi-col list partition on the same column query is not picking partition wise join. Is this expected? CREATE TABLE plt1 (a int, b int, c varchar) PARTITION BY LIST(c,c); CREATE TABLE

Re: Multi-Column List Partitioning

2021-10-07 Thread Rajkumar Raghuwanshi
Thanks Nitin, v4 patches applied cleanly and make check is passing now. While testing further I observed that if multiple values are given for a single column list partition it is not giving error instead it is changing values itself. Please find the example below. postgres=# CREATE TABLE plt1 (a

Re: Multi-Column List Partitioning

2021-10-01 Thread Zhihong Yu
On Fri, Oct 1, 2021 at 6:56 AM Amit Langote wrote: > Hi, > > On Mon, Sep 13, 2021 at 7:17 PM Rajkumar Raghuwanshi > wrote: > > On PG head + Nitin's v3 patch + Amit's Delta patch. Make check is > failing with below errors. > > Thanks Rajkumar for testing. > > > --inherit.sql is failing with erro

Re: Multi-Column List Partitioning

2021-10-01 Thread Amit Langote
Hi, On Mon, Sep 13, 2021 at 7:17 PM Rajkumar Raghuwanshi wrote: > On PG head + Nitin's v3 patch + Amit's Delta patch. Make check is failing > with below errors. Thanks Rajkumar for testing. > --inherit.sql is failing with error :"ERROR: negative bitmapset member not > allowed" > update mlpa

Re: Multi-Column List Partitioning

2021-09-13 Thread Rajkumar Raghuwanshi
On PG head + Nitin's v3 patch + Amit's Delta patch. Make check is failing with below errors. --inherit.sql is failing with error :"ERROR: negative bitmapset member not allowed" update mlparted_tab mlp set c = 'xxx' from (select a from some_tab union all select a+1 from some_tab) ss (a) where (

Re: Multi-Column List Partitioning

2021-09-03 Thread Amit Langote
On Wed, Sep 1, 2021 at 2:31 PM Amit Langote wrote: > On Tue, Aug 31, 2021 at 8:02 PM Nitin Jadhav > wrote: > > The attached patch also fixes the above comments. > > I noticed that multi-column list partitions containing NULLs don't > work correctly with partition pruning yet. > > create table p0

Re: Multi-Column List Partitioning

2021-08-31 Thread Amit Langote
Hi Nitin, On Tue, Aug 31, 2021 at 8:02 PM Nitin Jadhav wrote: > The attached patch also fixes the above comments. I noticed that multi-column list partitions containing NULLs don't work correctly with partition pruning yet. create table p0 (a int, b text, c bool) partition by list (a, b, c); cr

Re: Multi-Column List Partitioning

2021-08-30 Thread Amit Langote
On Mon, Aug 30, 2021 at 4:51 PM Rajkumar Raghuwanshi wrote: > > Hi Nitin. > > I have been testing these patches. Patches applied cleanly on the head. While > testing I found below a case where update row movement is not working > properly. > Please find the test case below. > > postgres=# create

Re: Multi-Column List Partitioning

2021-08-30 Thread Rajkumar Raghuwanshi
Hi Nitin. I have been testing these patches. Patches applied cleanly on the head. While testing I found below a case where update row movement is not working properly. Please find the test case below. postgres=# create table p0 (a int, b text, c bool) partition by list (a,b,c); CREATE TABLE postg

Re: Multi-Column List Partitioning

2021-08-27 Thread Nitin Jadhav
> + * isnulls is an array of boolean-tuples with key->partnatts booleans values > + * each. Currently only used for list partitioning, it stores whether a > > I think 'booleans' should be 'boolean'. > The trailing word 'each' is unnecessary. > bq. Supported new syantx to allow mentioning multiple

Re: Multi-Column List Partitioning

2021-08-25 Thread Zhihong Yu
On Wed, Aug 25, 2021 at 5:41 AM Nitin Jadhav wrote: > > The new list bound binary search and related comparison support > > function look a bit too verbose to me. I was expecting > > partition_list_bsearch() to look very much like > > partition_range_datum_bsearch(), but that is not the case. T

Re: Multi-Column List Partitioning

2021-06-11 Thread Zhihong Yu
On Thu, Jun 10, 2021 at 8:38 PM Amit Langote wrote: > Hi Nitin, > > On Thu, Jun 3, 2021 at 11:45 PM Nitin Jadhav > wrote: > > > I'll wait for you to post a new patch addressing at least the comments > > > in my earlier email. Also, please make sure to run `make check` > > > successfully before

Re: Multi-Column List Partitioning

2021-06-10 Thread Amit Langote
On Fri, Jun 11, 2021 at 12:37 PM Amit Langote wrote: > I will look at other parts of the patch next week hopefully. For > now, attached is a delta patch that applies on top of your v1, which > does: > > * Simplify partition_list_bsearch() and partition_lbound_datum_cmp() > * Make qsort_partition

Re: Multi-Column List Partitioning

2021-06-10 Thread Amit Langote
Hi Nitin, On Thu, Jun 3, 2021 at 11:45 PM Nitin Jadhav wrote: > > I'll wait for you to post a new patch addressing at least the comments > > in my earlier email. Also, please make sure to run `make check` > > successfully before posting the patch. :) > > I have fixed all of the review comments g

Re: Multi-Column List Partitioning

2021-06-03 Thread Nitin Jadhav
> Approach 1 sounds better. It sounds like approach 1 might help us > implement support for allowing NULLs in range partition bounds in the > future, if at all. For now, it might be better to not allocate the > isnull array except for list partitioning. Thanks for confirming. > I'll wait for yo

Re: Multi-Column List Partitioning

2021-05-25 Thread Amit Langote
On Sun, May 23, 2021 at 6:49 PM Nitin Jadhav wrote: > > IMO, it is not such a bad syntax from a user's PoV. It's not hard to > > understand from this syntax that the partition constraint is something > > like (a, b) = (1, 2) OR (a, b) = (1, 5) OR ..., where the = performs > > row-wise comparison.

Re: Multi-Column List Partitioning

2021-05-23 Thread Nitin Jadhav
> Yes, it would be nice to have this. Thanks for picking this up. Thanks for confirming. > Some quick observations: Thanks for providing the comments. I will handle these cases. > Hmm, why not have parentheses around these lists, that is: ( > (list_of_values) [, ...] ) > > So your example woul

Re: Multi-Column List Partitioning

2021-05-21 Thread Amit Langote
On Fri, May 21, 2021 at 1:02 PM Amit Langote wrote: > I will now take a look at the patch itself. Some quick observations: * I get a lot of instances of the following 2 warnings when compiling the patched code: Warning #1: partprune.c: In function ‘get_matching_list_bounds’: partprune.c:2731:1

Re: Multi-Column List Partitioning

2021-05-20 Thread Amit Langote
Hello Nitin, On Thu, May 6, 2021 at 11:03 PM Nitin Jadhav wrote: > > Hi, > > While reviewing one of the 'Table partitioning' related patches, I found that > Postgres does not support multiple column based LIST partitioning. Based on > this understanding, I have started working on this feature.

Re: Multi-Column List Partitioning

2021-05-08 Thread Nitin Jadhav
Thanks Jeevan for looking into this thread. > I did not review the patch in detail, but a quick look at it leaves me > with following comments: I will incorporate these changes. > ...FOR VALUES IN (1, 2, 3, 4), (11, 22, 33, 44), where the first set > is the list for values of column A and second

Re: Multi-Column List Partitioning

2021-05-07 Thread Jeevan Ladhe
> While reviewing one of the 'Table partitioning' related patches, > I found that Postgres does not support multiple column based LIST > partitioning. Based on this understanding, I have started working on > this feature. I also feel that 'Multi-Column List Partitioning' can > be benefited to the P