RE: Avoid repeated PQfnumber() in pg_dump

From: "houzj(dot)fnst(at)fujitsu(dot)com" <houzj(dot)fnst(at)fujitsu(dot)com>
To: Daniel Gustafsson <daniel(at)yesql(dot)se>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Justin Pryzby <pryzby(at)telsasoft(dot)com>
Subject: RE: Avoid repeated PQfnumber() in pg_dump
Date: 2021-07-15 02:51:02
Message-ID: OS0PR01MB5716E0112B1BAF4AD544EF4594129@OS0PR01MB5716.jpnprd01.prod.outlook.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On July 15, 2021 5:35 AM Daniel Gustafsson <daniel(at)yesql(dot)se> wrote:
> > On 14 Jul 2021, at 10:54, houzj(dot)fnst(at)fujitsu(dot)com wrote:
>
> > Since PQfnumber() is not a cheap function, I think we'd better invoke
> > PQfnumber() out of the loop like the attatched patch.
>
> Looks good on a quick readthrough, and I didn't see any other similar
> codepaths in pg_dump on top of what you've fixed.

Thanks for reviewing the patch.
Added to the CF: https://commitfest.postgresql.org/34/3254/

> > After applying this change, I can see about 8% performance gain in my
> > test environment when dump table definitions which have many columns.
>
> Out of curiosity, how many columns are "many columns"?

I tried dump 10 table definitions while each table has 1000 columns
(maybe not real world case).

Best regards,
houzj

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Ranier Vilela 2021-07-15 02:55:04 Re: [PATCH] Use optimized single-datum tuplesort in ExecSort
Previous Message Fujii Masao 2021-07-15 02:49:33 Re: Remove redundant Assert(PgArchPID == 0); in PostmasterStateMachine