Use pgstat_progress_update_multi_param instead of single param update

From: Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com>
To: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Use pgstat_progress_update_multi_param instead of single param update
Date: 2021-02-21 06:00:21
Message-ID: CALj2ACV5zW7GxD8D_tyO==bcj6ZktQchEKWKPBOAGKiLhAQo=w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

While reviewing progress reporting for COPY command patches [1], a
point on using pgstat_progress_update_multi_param instead of
pgstat_progress_update_param wherever possible was suggested in [1].
We could do multiple param updates at once with a single API than
doing each param update separately. The advantages are - 1) reducing
few function calls making the code look cleaner 2) atomically updating
multiple parameters at once within a single backend write critical
section i.e. incrementing st_changecount at once in a critical
section instead of doing it for each param separately.

Attached is a patch that replaces some subsequent multiple
update_param calls with a single update_multi_param.

Thoughts?

[1] - https://www.postgresql.org/message-id/CALj2ACXQrFM%2BDSN9xr%3D%2ByRotBufnC_xgG-FQ6VXAUZRPihZAew%40mail.gmail.com

With Regards,
Bharath Rupireddy.
EnterpriseDB: http://www.enterprisedb.com

Attachment Content-Type Size
v1-0001-Update-multiple-progress-params-at-once.patch application/octet-stream 3.3 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Kapila 2021-02-21 06:02:29 Re: repeated decoding of prepared transactions
Previous Message Joel Jacobson 2021-02-21 05:46:56 Mysterious ::text::char cast: ascii(chr(32)::char) = 0