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

Reply via email to