Re: Make set_ps_display faster and easier to use

From: David Rowley <dgrowleyml(at)gmail(dot)com>
To: Andres Freund <andres(at)anarazel(dot)de>
Cc: PostgreSQL Developers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Make set_ps_display faster and easier to use
Date: 2023-02-17 08:44:06
Message-ID: CAApHDvrx-kwtWFaO8_hxS5fBYeAe-Rp0YWATZSwBJx8UVu9bJA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Thank you for having a look at this.

On Fri, 17 Feb 2023 at 14:01, Andres Freund <andres(at)anarazel(dot)de> wrote:
> > +set_ps_display_suffix(const char *suffix)
> > +{
> > + size_t len;
>
> Think this will give you an unused-variable warning in the PS_USE_NONE case.

Fixed

> > +#ifndef PS_USE_NONE
> > + /* update_process_title=off disables updates */
> > + if (!update_process_title)
> > + return;
> > +
> > + /* no ps display for stand-alone backend */
> > + if (!IsUnderPostmaster)
> > + return;
> > +
> > +#ifdef PS_USE_CLOBBER_ARGV
> > + /* If ps_buffer is a pointer, it might still be null */
> > + if (!ps_buffer)
> > + return;
> > +#endif
>
> This bit is now repeated three times. How about putting it into a helper?

Good idea. Done.

> > +set_ps_display_internal(void)
>
> Very very minor nit: Perhaps this should be update_ps_display() or
> flush_ps_display() instead?

I called the precheck helper update_ps_display_precheck(), so went
with flush_ps_display() for updating the display so they both didn't
start with "update".

Updated patch attached.

David

Attachment Content-Type Size
optimize_and_make_set_ps_display_better_v2.patch text/plain 14.7 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Etsuro Fujita 2023-02-17 08:45:51 Doc: Improve note about copying into postgres_fdw foreign tables in batch
Previous Message Katsuragi Yuta 2023-02-17 08:43:13 Re: [Proposal] Add foreign-server health checks infrastructure