pgsql: Avoid invoking PQfnumber in loop constructs

From: Daniel Gustafsson <dgustafsson(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Avoid invoking PQfnumber in loop constructs
Date: 2021-08-27 14:25:25
Message-ID: E1mJcnN-00043p-Gl@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Avoid invoking PQfnumber in loop constructs

When looping over the resultset from a SQL query, extracting the field
number before the loop body to avoid repeated calls to PQfnumber is an
established pattern. On very wide tables this can have a performance
impact, but it wont be noticeable in the common case. This fixes a few
queries which were extracting the field number in the loop body.

Author: Hou Zhijie <houzj(dot)fnst(at)fujitsu(dot)com>
Reviewed-by: Nathan Bossart <bossartn(at)amazon(dot)com>
Discussion: https://postgr.es/m/OS0PR01MB57164C392783F29F6D0ECA0B94139@OS0PR01MB5716.jpnprd01.prod.outlook.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/d782d5987e1022ba70171bcf3507cd87564ef23c

Modified Files
--------------
src/bin/pg_dump/pg_dump.c | 94 +++++++++++++++++++++++++++++++++++------------
1 file changed, 71 insertions(+), 23 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2021-08-27 16:19:07 pgsql: Handle interaction of regexp's makesearch and MATCHALL more hone
Previous Message Dilip Kumar 2021-08-27 06:34:31 Re: Separate out FileSet from SharedFileSet (was Re: pgsql: pgstat: Bring up pgstat in BaseInit() to fix uninitialized use o)