Managing E-Maj Parameters

Parameters

The E-Maj extension uses 9 parameters that can be configured by E-Maj administrators.

Three parameters relate to the extension’s general functionality:

Key

Meaning

Default Value

history_retention

Retention period for rows in historical tables (a)

1 year

dblink_user_password

User and password for E-Maj rollback operations (b)

alter_log_table

ALTER TABLE directive executed at log table creation (c)

Notes

The history_retention parameter value must be castable to INTERVAL. A value greater or equal to 100 years disables the histories purge.

The dblink_user_password parameter is required to monitor or launch parallel E-Maj rollbacks. Format: 'user=<user> password=<password>'. These features are disabled by default.

The alter_log_table parameter allows adding one or more technical columns to log tables. By default, no ALTER TABLE is executed.


Six other parameters relate to the E-Maj rollback duration estimation model, used in particular by the emaj_estimate_rollback_group() function. All must be castable to INTERVAL. These parameters can be adjusted to better reflect the performance of the server hosting the database.

Key

Meaning

Default Value

fixed_step_rollback_duration

Fixed cost for each rollback step

2.5 ms

fixed_dblink_rollback_duration

Additional cost for each rollback step when using a dblink connection

4 ms

fixed_table_rollback_duration

Fixed rollback cost for any table or sequence in a group

1 ms

avg_row_rollback_duration

Average duration of a row rollback

100 µs

avg_row_delete_log_duration

Average duration of a log row deletion

10 µs

avg_fkey_check_duration

Average duration of a foreign key value check

20 µs


Setting Parameter Values

The emaj_set_param() function allows E-Maj administrators to modify a parameter value.

SELECT emaj.emaj_set_param(p_key, p_value);

Input Parameters

  • p_key (TEXT): Parameter key.

  • p_value (TEXT): Parameter value. A NULL value resets the parameter to its default value.

Returned data

The function returns the number of updated parameters (0 or 1).

Notes

Keys are case-insensitive.

Parameter values are character strings. For parameters representing time intervals, the string must be a valid INTERVAL format (e.g., '3 us' or '3 microseconds').

Any parameter change is logged in the emaj_hist table.

The emaj_export_parameters_configuration() and emaj_import_parameters_configuration() functions allow saving and restoring parameter values.


Viewing Parameters

The emaj.emaj_all_param view provides administrators with a comprehensive overview of all parameters, including their current and default values.

The structure of the emaj_all_param view is:

Column

Type

Description

param_key

TEXT

Parameter identifier

param_value

TEXT

Current parameter value

param_default

TEXT

Default parameter value

param_cast

TEXT

Parameter data format (NULL for text or INTERVAL)

param_rank

INT

Parameter display rank

Users with emaj_viewer privileges can only read parameters using the emaj.emaj_visible_param view, which masks the dblink_user_password parameter value.