You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
WHERE proc_name ='policy_compression'AND hypertable_name ='conditions';
92
87
```
93
88
94
-
The same applies to other policy types. For example, to change `drop_after` on a [data retention policy](/reference/timescaledb/data-retention/add_retention_policy):
89
+
This works the same for every policy type. For example, to change `drop_after` on a [data retention policy](/reference/timescaledb/data-retention/add_retention_policy):
WHERE proc_name ='policy_retention'AND hypertable_name ='conditions';
100
95
```
101
96
102
-
However, to change the `after` or `created_before`, the compression settings, or the {C.HYPERTABLE} the policy is acting on, you must [remove the {C.COLUMNSTORE} policy](/reference/timescaledb/hypercore/remove_columnstore_policy) and [add a new one](/reference/timescaledb/hypercore/add_columnstore_policy).
97
+
Use `config` only when you want to replace the configuration in full. Policies keep required keys such as
98
+
`hypertable_id` in `config`, so passing just the key you want to change drops the rest and the call fails with
99
+
`ERROR: could not find hypertable_id in config for job`. On earlier versions, where `config_merge` is not available,
100
+
patch the current `config` with [`jsonb_set`](https://www.postgresql.org/docs/current/functions-json.html) instead.
101
+
102
+
Some settings cannot be changed this way at all. To change the `after` or `created_before`, the compression settings, or
103
+
the {C.HYPERTABLE} the policy is acting on, you must [remove the {C.COLUMNSTORE} policy](/reference/timescaledb/hypercore/remove_columnstore_policy) and [add a new one](/reference/timescaledb/hypercore/add_columnstore_policy).
103
104
104
105
-**Convert {C.CAGG}{C.CHUNK}s to the {C.COLUMNSTORE} after each refresh**:
105
106
@@ -114,10 +115,7 @@ another crash.
114
115
AND hypertable_name ='<cagg_name>';
115
116
116
117
-- Enable compress_after_refresh:
117
-
SELECT alter_job(<job_id>,
118
-
config => jsonb_set(
119
-
(SELECT config FROM_timescaledb_catalog.bgw_jobWHERE id =<job_id>),
|`retry_period`|INTERVAL| - | ✖ | The amount of time the scheduler waits between retries of the job on failure. |
152
151
|`scheduled`|BOOLEAN|`true`| ✖ | Set to `false` to exclude this job from being run as a background job. |
153
152
| `config` |JSONB| - | ✖| {C.JOB_CAP}-specific configuration, passed to the function when it runs. For the {C.COLUMNSTORE} policy this includes: <ul><li>`maxchunks_to_compress`: integer, defaults to `0` (no limit). The maximum number of {C.CHUNK}s to add to the {C.COLUMNSTORE} during a policy run.</li><li>`compress_after`: see [`add_columnstore_policy`](/reference/timescaledb/hypercore/add_columnstore_policy#arguments).</li><li>`compress_created_before`: see [`add_columnstore_policy`](/reference/timescaledb/hypercore/add_columnstore_policy#arguments).</li></ul> For the {C.CAGG} refresh policy this includes <ul><li>`compress_after_refresh`: boolean, defaults to `false`. When `true`, {C.TIMESCALE_DB} converts the {C.CAGG} {C.CHUNK}s in the refresh window to the {C.COLUMNSTORE} at the end of each scheduled refresh. Since 2.27.0.</li></ul> |
153
+
| `config_merge` |JSONB| - | ✖| Since 2.29.0. Merge these keys into the {C.JOB}'s existing `config` instead of replacing it. The keys you pass take precedence, and the keys you leave out are unchanged. Cannot be combined with `config`. |
154
154
|`next_start`|TIMESTAMPTZ| - | ✖ | The next time at which to run the job. The job can be paused by setting this value to `infinity`, and restarted with a value of `now()`. |
155
155
|`if_exists`|BOOLEAN|`false`| ✖ | Set to `true` to issue a notice instead of an error if the job does not exist. |
156
156
|`check_config`| REGPROC | - | ✖ | A function that takes a single argument, the `JSONB``config` structure. The function is expected to raise an error if the configuration is not valid, and return nothing otherwise. Can be used to validate the configuration when updating a job. Only functions, not procedures, are allowed as values for `check_config`. |
0 commit comments