From: | Zhihong Yu <zyu(at)yugabyte(dot)com> |
---|---|
To: | Amit Langote <amitlangote09(at)gmail(dot)com> |
Cc: | "houzj(dot)fnst(at)fujitsu(dot)com" <houzj(dot)fnst(at)fujitsu(dot)com>, David Rowley <dgrowleyml(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, "tsunakawa(dot)takay(at)fujitsu(dot)com" <tsunakawa(dot)takay(at)fujitsu(dot)com> |
Subject: | Re: Skip partition tuple routing with constant partition key |
Date: | 2021-06-17 07:23:09 |
Message-ID: | CALNJ-vQnG+EDEdnehzY2NeuSyDpPyMeAi29Vw6iK6e_91xsNUA@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Wed, Jun 16, 2021 at 10:37 PM Amit Langote <amitlangote09(at)gmail(dot)com>
wrote:
> Hi,
>
> Thanks for reading the patch.
>
> On Thu, Jun 17, 2021 at 1:46 PM Zhihong Yu <zyu(at)yugabyte(dot)com> wrote:
> > On Wed, Jun 16, 2021 at 9:29 PM Amit Langote <amitlangote09(at)gmail(dot)com>
> wrote:
> >> Attached a slightly revised version of that patch, with a commit
> >> message this time.
> >
> > + int n_tups_inserted;
> > + int n_offset_changed;
> >
> > Since tuples appear in plural, maybe offset should be as well: offsets.
>
> I was hoping one would read that as "the number of times the offset
> changed" while inserting "that many tuples", so the singular form
> makes more sense to me.
>
> Actually, I even considered naming the variable n_offsets_seen, in
> which case the plural form makes sense, but I chose not to go with
> that name.
>
> > + part_index = get_cached_list_partition(pd, boundinfo,
> key,
> > + values);
> >
> > nit:either put values on the same line, or align the 4 parameters on
> different lines.
>
> Not sure pgindent requires us to follow that style, but I too prefer
> the way you suggest. It does make the patch a bit longer though.
>
> > + if (part_index < 0)
> > + {
> > + bound_offset =
> partition_range_datum_bsearch(key->partsupfunc,
> >
> > Do we need to check the value of equal before computing part_index ?
>
> Just in case you didn't notice, this is not new code, but appears as a
> diff hunk due to indenting.
>
> As for whether the code should be checking 'equal', I don't think the
> logic at this particular site should do that. Requiring 'equal' to be
> true would mean that this code would only accept tuples that exactly
> match the bound that partition_range_datum_bsearch() returned.
>
> Updated patch attached. Aside from addressing your 2nd point, I fixed
> a typo in a comment.
>
> --
> Amit Langote
> EDB: http://www.enterprisedb.com
Hi, Amit:
Thanks for the quick response.
w.r.t. the last point, since variable equal is defined within the case of
PARTITION_STRATEGY_RANGE,
I wonder if it can be named don_t_care or something like that.
That way, it would be clearer to the reader that its value is purposefully
not checked.
It is fine to leave the variable as is since this was existing code.
Cheers
From | Date | Subject | |
---|---|---|---|
Next Message | Fabien COELHO | 2021-06-17 07:24:37 | Re: pgbench logging broken by time logic changes |
Previous Message | Amit Langote | 2021-06-17 07:22:06 | Re: Decoding speculative insert with toast leaks memory |