forked from github/docs
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Default value for schedule_interval (github#606)
* Notes default valur for schedule_interval, plus general light editing. * Add section about parallel copy tool * Update api/add_continuous_aggregate_policy.md Co-authored-by: Jacob Prall <prall.jacob@gmail.com>
- Loading branch information
1 parent
bccb18e
commit 3cbe2c7
Showing
6 changed files
with
100 additions
and
109 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,44 @@ | ||
## add_continuous_aggregate_policy() <tag type="community">Community</tag> | ||
|
||
## add_continuous_aggregate_policy() <tag type="community">Community</tag> | ||
Create a policy that automatically refreshes a continuous aggregate. | ||
|
||
### Required Arguments | ||
### Required arguments | ||
|
||
|Name|Type|Description| | ||
|---|---|---| | ||
| `continuous_aggregate` | REGCLASS | The continuous aggregate to add the policy for. | | ||
| `start_offset` | INTERVAL or integer | Start of the refresh window as an interval relative to the time when the policy is executed | | ||
| `end_offset` | INTERVAL or integer | End of the refresh window as an interval relative to the time when the policy is executed | | ||
| `schedule_interval` | INTERVAL | Interval between refresh executions in wall-clock time. | | ||
|-|-|-| | ||
|`continuous_aggregate`|REGCLASS|The continuous aggregate to add the policy for| | ||
|`start_offset`|INTERVAL or integer|Start of the refresh window as an interval relative to the time when the policy is executed| | ||
|`end_offset`|INTERVAL or integer|End of the refresh window as an interval relative to the time when the policy is executed| | ||
|`schedule_interval`|INTERVAL|Interval between refresh executions in wall-clock time. Defaults to 24 hours| | ||
|
||
The `start_offset` should be greater than `end_offset`. | ||
The `start_offset` and `end_offset` parameters should be specified differently depending on the type of the time column of the hypertable: | ||
- For hypertables with TIMESTAMP, TIMESTAMPTZ, and DATE time columns: the offset should be an INTERVAL type | ||
- For hypertables with integer-based timestamps: the offset should be an integer type. | ||
|
||
### Optional Arguments | ||
You must specify the `start_offset` and `end_offset` parameters differently, | ||
depending on the type of the time column of the hypertable: | ||
* For hypertables with `TIMESTAMP`, `TIMESTAMPTZ`, and `DATE` time columns, | ||
set the offset as an `INTERVAL` type | ||
* For hypertables with integer-based timestamps, set the offset as | ||
an `INTEGER` type. | ||
|
||
### Optional arguments | ||
|
||
|Name|Type|Description| | ||
|---|---|---| | ||
| `if_not_exists` | BOOLEAN | Set to true to avoid throwing an error if the continuous aggregate policy already exists. A notice is issued instead. Defaults to false. | | ||
|-|-|-| | ||
|`if_not_exists`|BOOLEAN|Set to `true `to issue a notice instead of an error if the job does not exist. Defaults to false.| | ||
|
||
### Returns | ||
### Returns | ||
|
||
|Column|Type|Description| | ||
|---|---|---| | ||
|`job_id`| INTEGER | TimescaleDB background job id created to implement this policy| | ||
|
||
|-|-|-| | ||
|`job_id`|INTEGER|TimescaleDB background job ID created to implement this policy| | ||
|
||
### Sample Usage | ||
|
||
Add a policy that refreshes the last month once an hour, excluding the latest hour from the aggregate (for performance reasons, it is recommended to exclude buckets that still see lots of writes): | ||
### Sample use | ||
Add a policy that refreshes the last month once an hour, excluding the latest | ||
hour from the aggregate. For performance reasons, we recommend that you | ||
exclude buckets that see lots of writes: | ||
```sql | ||
SELECT add_continuous_aggregate_policy('conditions_summary', | ||
start_offset => INTERVAL '1 month', | ||
end_offset => INTERVAL '1 hour', | ||
schedule_interval => INTERVAL '1 hour'); | ||
``` | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,63 +1,59 @@ | ||
## alter_job() <tag type="community">Community</tag> | ||
Actions scheduled using the TimescaleDB automation framework run periodically in | ||
a background worker. You can change the schedule of these jobs with the | ||
`alter_job` function. To alter an existing job, refer to it by `job_id`. The | ||
`job_id` runs a given action, and its current schedule can be found in the | ||
`timescaledb_information.jobs` view, which lists information about every | ||
scheduled action, as well as in `timescaledb_information.job_stats`. The | ||
`job_stats` view also gives information about when each job was last run and | ||
other useful statistics for deciding what the new schedule should be. | ||
|
||
Actions scheduled via TimescaleDB's automation framework run periodically in a | ||
background worker. You can change the schedule of their execution using `alter_job`. | ||
To alter an existing job, you must refer to it by `job_id`. | ||
The `job_id` which executes a given action and its current schedule can be found | ||
either in the `timescaledb_information.jobs` view, which lists information | ||
about every scheduled action, as well as in `timescaledb_information.job_stats`. | ||
The `job_stats` view additionally contains information about when each job was | ||
last run and other useful statistics for deciding what the new schedule should be. | ||
|
||
### Required Arguments | ||
### Required arguments | ||
|
||
|Name|Type|Description| | ||
|---|---|---| | ||
| `job_id` | INTEGER | the id of the policy job being modified | | ||
|-|-|-| | ||
|`job_id`|INTEGER|The ID of the policy job being modified| | ||
|
||
### Optional Arguments | ||
### Optional arguments | ||
|
||
|Name|Type|Description| | ||
|---|---|---| | ||
| `schedule_interval` | INTERVAL | The interval at which the job runs | | ||
| `max_runtime` | INTERVAL | The maximum amount of time the job is allowed to run by the background worker scheduler before it is stopped | | ||
| `max_retries` | INTEGER | The number of times the job is retried should it fail | | ||
| `retry_period` | INTERVAL | The amount of time the scheduler waits between retries of the job on failure | | ||
| `scheduled` | BOOLEAN | Set to `FALSE` to exclude this job from being run as background job. | | ||
| `config` | JSONB | Job-specific configuration (this is passed to the function when executed)| | ||
| `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()). | | ||
| `if_exists` | BOOLEAN | Set to true to avoid throwing an error if the job does not exist, a notice is issued instead. Defaults to false. | | ||
|-|-|-| | ||
|`schedule_interval`|INTERVAL|The interval at which the job runs. Defaults to 24 hours| | ||
|`max_runtime`|INTERVAL|The maximum amount of time the job is allowed to run by the background worker scheduler before it is stopped| | ||
|`max_retries`|INTEGER|The number of times the job is retried if it fails| | ||
|`retry_period`|INTERVAL|The amount of time the scheduler waits between retries of the job on failure| | ||
|`scheduled`|BOOLEAN|Set to `FALSE` to exclude this job from being run as background job| | ||
|`config`|JSONB|Job-specific configuration, passed to the function when it runs| | ||
|`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()`| | ||
|`if_exists`|BOOLEAN|Set to `true `to issue a notice instead of an error if the job does not exist. Defaults to false.| | ||
|
||
### Returns | ||
|
||
|Column|Type|Description| | ||
|---|---|---| | ||
| `job_id` | INTEGER | the id of the job being modified | | ||
| `schedule_interval` | INTERVAL | The interval at which the job runs | | ||
| `max_runtime` | INTERVAL | The maximum amount of time the job is allowed to run by the background worker scheduler before it is stopped | | ||
| `max_retries` | INTEGER | The number of times the job is retried should it fail | | ||
| `retry_period` | INTERVAL | The amount of time the scheduler waits between retries of the job on failure | | ||
| `scheduled` | BOOLEAN | True if this job is executed by the TimescaleDB scheduler. | | ||
| `config` | JSONB | Job-specific configuration (this is passed to the function when executed)| | ||
| `next_start` | TIMESTAMPTZ | The next time at which to run the job. | | ||
|
||
### Sample Usage | ||
|
||
|-|-|-| | ||
|`job_id`|INTEGER|The ID of the job being modified| | ||
|`schedule_interval`|INTERVAL|The interval at which the job runs. Defaults to 24 hours| | ||
|`max_runtime`|INTERVAL|The maximum amount of time the job is allowed to run by the background worker scheduler before it is stopped| | ||
|`max_retries`|INTEGER|The number of times the job is retried if it fails| | ||
|`retry_period`|INTERVAL|The amount of time the scheduler waits between retries of the job on failure| | ||
|`scheduled`|BOOLEAN|Returns `true` if the job is executed by the TimescaleDB scheduler| | ||
|`config`|JSONB|Job-specific configuration, passed to the function when it runs| | ||
|`next_start`|TIMESTAMPTZ|The next time to run the job| | ||
|
||
### Sample use | ||
Reschedules job ID `1000` so that it runs every two days: | ||
```sql | ||
SELECT alter_job(1000, schedule_interval => INTERVAL '2 days'); | ||
``` | ||
Reschedules the job with id 1000 so that it runs every two days. | ||
|
||
Disables scheduling of the compression policy on the `conditions` hypertable: | ||
```sql | ||
SELECT alter_job(job_id, scheduled => false) | ||
FROM timescaledb_information.jobs | ||
WHERE proc_name = 'policy_compression' AND hypertable_name = 'conditions' | ||
``` | ||
Disables scheduling of the compression policy on hypertable `conditions`. | ||
|
||
Reschedules continuous aggregate job ID `1000` so that it next runs at 9:00:00 on 15 March, 2020: | ||
```sql | ||
SELECT alter_job(1015, next_start => '2020-03-15 09:00:00.0+00'); | ||
SELECT alter_job(1000, next_start => '2020-03-15 09:00:00.0+00'); | ||
``` | ||
|
||
Reschedules continuous aggregate job `1015` so that the next execution of the | ||
job starts at the specified time (9:00:00 am on March 15, 2020). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters