some ideas from users - Mailing list pgsql-hackers

From Pavel Stehule
Subject some ideas from users
Date
Msg-id CAFj8pRDKBLyfRD1L5GVxiP8xnFs0BR2JFzc-r3Vswth5c7yuWA@mail.gmail.com
Whole thread Raw
Responses Re: some ideas from users  (Marko Tiikkaja <marko@joh.to>)
Re: some ideas from users  (Andrew Dunstan <andrew@dunslane.net>)
List pgsql-hackers
Hi

I did a week training and here are some ideas from people, who are starting with Postgres.

1. possibility to set server side variables simply as psql option. Motivation - more simple and natural changing datestyle for psql in shell scripts. "--set" is allocated now, but theoretically we can use any unknown long option as server side session variable.

echo "select ..." | psql --datestyle=YMD --enable_seqscan=off

2. missing table function with all settings. Like SHOW ALL, but with filtering possibility

It should not be difficult:

CREATE OR REPLACE FUNCTION public.settings(OUT name text, OUT setting text, OUT description text)
 RETURNS SETOF record
 LANGUAGE plpgsql
AS $function$
BEGIN
  RETURN QUERY EXECUTE 'SHOW ALL'
  RETURN;
END;
$function$

Usage:

postgres=# select * from settings() where name like '%checkpoint%';
             name             | setting |                                       description                                       
------------------------------+---------+------------------------------------------------------------------------------------------
 checkpoint_completion_target | 0.5     | Time spent flushing dirty buffers during checkpoint, as fraction of checkpoint interval.
 checkpoint_segments          | 3       | Sets the maximum distance in log segments between automatic WAL checkpoints.
 checkpoint_timeout           | 5min    | Sets the maximum time between automatic WAL checkpoints.
 checkpoint_warning           | 30s     | Enables warnings if checkpoint segments are filled more frequently than this.
 log_checkpoints              | off     | Logs each checkpoint.
(5 rows)

Regards

Pavel

pgsql-hackers by date:

Previous
From: Amit Kapila
Date:
Subject: Re: Turning recovery.conf into GUCs
Next
From: Marko Tiikkaja
Date:
Subject: Re: some ideas from users