Re: Generating partitioning tuple conversion maps faster - Mailing list pgsql-hackers

From David Rowley
Subject Re: Generating partitioning tuple conversion maps faster
Date
Msg-id CAKJS1f8Rdhkq_xXQhT=O1puJ_=S35=e-C9sbGhoCs-FYgzVFkQ@mail.gmail.com
Whole thread Raw
In response to Re: Generating partitioning tuple conversion maps faster  (Alexander Kuzmenkov <a.kuzmenkov@postgrespro.ru>)
Responses Re: Generating partitioning tuple conversion maps faster
List pgsql-hackers
On 29 June 2018 at 02:23, Alexander Kuzmenkov
<a.kuzmenkov@postgrespro.ru> wrote:
> I think I found one possible reason for this slowness. Your patch behaves as
> expected when there is a dropped output column, but does one extra
> comparison when there is a dropped input column. This backwards conversion
> is called from ExecInitRoutingInfo. To fix this, I'd just keep a persistent
> inner loop counter (see the attached patch).

It's just 2000 comparisons vs 1000.

> Still, fixing this doesn't improve the performance. According to perf
> report, updatepd.sql spends 25% of time in strcmp, and updatep.sql about
> 0.5%, but they are comparing the same column names, even with the same
> alignment and relative offsets. I'm completely puzzled by this.

On further inspection, the slowdown is coming from the planner in
make_inh_translation_list(). The INSERT path does not hit that since
the planner's job is pretty simple for simple INSERTs.

> As a side thought, we wouldn't have to go through this if we had a hash
> table that is easy to use, or perhaps string interning in catcache.

Maybe it's better to try the direct lookup and fall back on
SearchSysCacheAttName() if the same attnum does not have the same
name.


-- 
 David Rowley                   http://www.2ndQuadrant.com/
 PostgreSQL Development, 24x7 Support, Training & Services


pgsql-hackers by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: Server crashed with "TRAP: unrecognized TOAST vartag("1", File:"heaptuple.c", Line: 1490)"
Next
From: Chapman Flack
Date:
Subject: Re: SQL/JSON: documentation