From: glyn Date: Fri, 5 Dec 2014 18:22:49 +0000 (+0000) Subject: Stop doing useless work X-Git-Url: https://git.8kb.co.uk/?p=postgresql%2Fpg_settings_history;a=commitdiff_plain Stop doing useless work --- diff --git a/pg_settings_history.plpgsql b/pg_settings_history.plpgsql index 371b9f8..3c7102f 100755 --- a/pg_settings_history.plpgsql +++ b/pg_settings_history.plpgsql @@ -59,13 +59,17 @@ BEGIN GET DIAGNOSTICS v_changes = ROW_COUNT; - -- Update the snapshot ready for the next run. - TRUNCATE public.pg_settings_last; - INSERT INTO pg_settings_last (name, setting, unit, category, short_desc, extra_desc, context, vartype, source, min_val, + IF (v_changes > 0) THEN + -- Update the snapshot ready for the next run. + TRUNCATE public.pg_settings_last; + INSERT INTO pg_settings_last (name, setting, unit, category, short_desc, extra_desc, context, vartype, source, min_val, max_val, enumvals, boot_val, reset_val, sourcefile, sourceline) - SELECT * FROM pg_settings; - - RETURN (v_changes > 0); + SELECT * FROM pg_settings; + + RETURN true; + ELSE + RETURN false; + END IF; END IF; END;