pg.ddx.io pgsql-admin@postgresql.org mailing list archive
help / color / mirror / Atom feedHow to _not_ save startup options in postmaster.opts?
6+ messages / 4 participants
[nested] [flat]
* How to _not_ save startup options in postmaster.opts?
@ 2023-11-02 17:01 Ron <ronljohnsonjr@gmail.com>
0 siblings, 1 reply; 6+ messages in thread
From: Ron @ 2023-11-02 17:01 UTC (permalink / raw)
To: Pgsql-admin <pgsql-admin@lists.postgresql.org>
Pg 14, if it matters.
When doing maintenance (including a giant pg_restore), sometime one wants to
run with different configuration values (like archivemode=off,
wal_level=minimal, autovacuum=off, etc).
I could edit postgresql.conf -- or have two of them: one normal, and one for
doing maintenance -- but if I'm going to restart anyway, why not just pass
those parameters directly to the postmaster?
Alas, those config values are remembered in postmaster.opts. But I don't
want that.
Thus: is there a way to tell pg to /not/ put those options in postmaster.opts?
Or is this my only option before restarting for production:
which postgres > $PGDATA/postmaster.opts
--
Born in Arizona, moved to Babylonia.
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: How to _not_ save startup options in postmaster.opts?
@ 2023-11-02 17:24 David G. Johnston <david.g.johnston@gmail.com>
parent: Ron <ronljohnsonjr@gmail.com>
0 siblings, 2 replies; 6+ messages in thread
From: David G. Johnston @ 2023-11-02 17:24 UTC (permalink / raw)
To: Ron <ronljohnsonjr@gmail.com>; +Cc: Pgsql-admin <pgsql-admin@lists.postgresql.org>
> Alas, those config values are remembered in postmaster.opts. But I don't
> want that.
>
I don’t know where this file is even documented ATM but my understanding is
it just shows you the values used during the last startup. It doesn’t
remember anything in any real sense because it isn’t used by the system to
determine what those parameter values should be during startup.
Use the -c functionality for your manual maintenance boots and just let the
normal startup mechanism do whatever it does when you re-engage it.
David J.
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: How to _not_ save startup options in postmaster.opts?
@ 2023-11-02 17:39 Sacha Kerres <skerres@kerres-edv.de>
0 siblings, 0 replies; 6+ messages in thread
From: Sacha Kerres @ 2023-11-02 17:39 UTC (permalink / raw)
To: Ron <ronljohnsonjr@gmail.com>; Pgsql-admin <pgsql-admin@lists.postgresql.org>
Hi,
https://www.postgresql.org/docs/16/config-setting.html
postgres -c log_connections=yes -c log_destination='syslog'
or
export PGOPTIONS="-c geqo=off -c statement_timeout=5min"
Mit freundlichen Grüßen
Sacha Kerres
Kerres-EDV Beratung
Deglhof 45-47
93142 Maxhütte-Haidhof
Tel. +49 9471 60 14 14
Mobil. +49 171 210 48 46
E-Mail. skerres@kerres-edv.de
Original Message processed by david®
How to _not_ save startup options in postmaster.opts? 2. November 2023, 18:01 Uhr
Von Ron
An Pgsql-admin
Pg 14, if it matters.
When doing maintenance (including a giant pg_restore), sometime one wants to run with different configuration values (like archivemode=off, wal_level=minimal, autovacuum=off, etc).
I could edit postgresql.conf -- or have two of them: one normal, and one for doing maintenance -- but if I'm going to restart anyway, why not just pass those parameters directly to the postmaster?
Alas, those config values are remembered in postmaster.opts. But I don't want that.
Thus: is there a way to tell pg to not put those options in postmaster.opts?
Or is this my only option before restarting for production:
which postgres > $PGDATA/postmaster.opts
--
Born in Arizona, moved to Babylonia.
To: ronljohnsonjr@gmail.com
pgsql-admin@lists.postgresql.org
Attachments:
[application/x-pkcs7-signature] smime.p7s (4.4K, ../../0001D1F9.6543ECD4@10.20.80.201/3-smime.p7s)
download
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: How to _not_ save startup options in postmaster.opts?
@ 2023-11-02 17:42 Tom Lane <tgl@sss.pgh.pa.us>
parent: David G. Johnston <david.g.johnston@gmail.com>
1 sibling, 1 reply; 6+ messages in thread
From: Tom Lane @ 2023-11-02 17:42 UTC (permalink / raw)
To: David G. Johnston <david.g.johnston@gmail.com>; +Cc: Ron <ronljohnsonjr@gmail.com>; Pgsql-admin <pgsql-admin@lists.postgresql.org>
"David G. Johnston" <david.g.johnston@gmail.com> writes:
>> Alas, those config values are remembered in postmaster.opts. But I don't
>> want that.
> I don’t know where this file is even documented ATM but my understanding is
> it just shows you the values used during the last startup.
It does more, per the pg_ctl man page:
postmaster.opts
If this file exists in the data directory, pg_ctl (in restart
mode) will pass the contents of the file as options to postgres,
unless overridden by the -o option. The contents of this file are
also displayed in status mode.
It seems totally reasonable for "pg_ctl restart" to re-apply those
switches. If you don't want that, don't use "restart", but stop
and start.
Or you could just remove the file.
regards, tom lane
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: How to _not_ save startup options in postmaster.opts?
@ 2023-11-02 19:27 Ron <ronljohnsonjr@gmail.com>
parent: David G. Johnston <david.g.johnston@gmail.com>
1 sibling, 0 replies; 6+ messages in thread
From: Ron @ 2023-11-02 19:27 UTC (permalink / raw)
To: Pgsql-admin <pgsql-admin@lists.postgresql.org>
On 11/2/23 12:24, David G. Johnston wrote:
>
> Alas, those config values are remembered in postmaster.opts. But I
> don't want that.
>
>
> I don’t know where this file is even documented ATM but my understanding
> is it just shows you the values used during the last startup. It doesn’t
> remember anything in any real sense because it isn’t used by the system to
> determine what those parameter values should be during startup.
https://pgpedia.info/p/postmaster.opts.html
"*|postmaster.opts|*is a file in the data directory written after startup
which contains the options used to start the postmaster process. The
contents of|postmaster.opts|are used to ensure the postmaster process can be
restarted with the same options with which it was originally started."
I've confirmed this behavior, which I why I wrote the email.
>
> Use the -c functionality for your manual maintenance boots and just let
> the normal startup mechanism do whatever it does when you re-engage it.
>
> David J.
>
--
Born in Arizona, moved to Babylonia.
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: How to _not_ save startup options in postmaster.opts?
@ 2023-11-02 19:31 Ron <ronljohnsonjr@gmail.com>
parent: Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 0 replies; 6+ messages in thread
From: Ron @ 2023-11-02 19:31 UTC (permalink / raw)
To: Pgsql-admin <pgsql-admin@lists.postgresql.org>
On 11/2/23 12:42, Tom Lane wrote:
> "David G. Johnston"<david.g.johnston@gmail.com> writes:
>>> Alas, those config values are remembered in postmaster.opts. But I don't
>>> want that.
>> I don’t know where this file is even documented ATM but my understanding is
>> it just shows you the values used during the last startup.
> It does more, per the pg_ctl man page:
>
> postmaster.opts
>
> If this file exists in the data directory, pg_ctl (in restart
> mode) will pass the contents of the file as options to postgres,
> unless overridden by the -o option. The contents of this file are
> also displayed in status mode.
>
> It seems totally reasonable for "pg_ctl restart" to re-apply those
> switches. If you don't want that, don't use "restart", but stop
> and start.
Thanks.
--
Born in Arizona, moved to Babylonia.
^ permalink raw reply [nested|flat] 6+ messages in thread
end of thread, other threads:[~2023-11-02 19:31 UTC | newest]
Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2023-11-02 17:01 How to _not_ save startup options in postmaster.opts? Ron <ronljohnsonjr@gmail.com>
2023-11-02 17:24 ` David G. Johnston <david.g.johnston@gmail.com>
2023-11-02 17:42 ` Tom Lane <tgl@sss.pgh.pa.us>
2023-11-02 19:31 ` Ron <ronljohnsonjr@gmail.com>
2023-11-02 19:27 ` Ron <ronljohnsonjr@gmail.com>
2023-11-02 17:39 Re: How to _not_ save startup options in postmaster.opts? Sacha Kerres <skerres@kerres-edv.de>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox