|
| 1 | +# Continous Aggregates, incremental parallel setup |
| 2 | + |
| 3 | +This code is exploring the possibilities to do incremental CAgg refreshes in parallel. |
| 4 | +The setup it uses is as following: |
| 5 | + |
| 6 | +## Producer |
| 7 | + |
| 8 | +We have a producer procedure (`schedule_refresh_continuous_aggregate_incremental`), |
| 9 | +which schedules tasks to be picked up by the consumers. |
| 10 | + |
| 11 | +The configuration for this call contains the following keys: |
| 12 | + |
| 13 | +```json |
| 14 | +{ |
| 15 | + "end_offset": "similar to end-offset in the policy", |
| 16 | + "start_offset": "similar to start-offset in the policy", |
| 17 | + "continuous_aggregate": "regclass / fully qualified name of the user view for the CAgg", |
| 18 | + "increment_size": "the size of each individual task, default: chunk_interval", |
| 19 | + "priority": "priority for these tasks. Lower numbers get processed earlier, default: 100" |
| 20 | +} |
| 21 | +``` |
| 22 | + |
| 23 | +Some example calls: |
| 24 | + |
| 25 | +### Producer Examples |
| 26 | + |
| 27 | +#### Schedule multiple jobs for this cagg, with increments of 1 week |
| 28 | + |
| 29 | +```json |
| 30 | +{ |
| 31 | + "end_offset": "14 days", |
| 32 | + "start_offset": "2 years", |
| 33 | + "continuous_aggregate": "public.stats_five_minutes", |
| 34 | + "increment_size": "1 week" |
| 35 | +} |
| 36 | +``` |
| 37 | + |
| 38 | +```sql |
| 39 | +CALL _timescaledb_additional.schedule_refresh_continuous_aggregate_incremental( |
| 40 | + job_id => null, |
| 41 | + config => $1 |
| 42 | +); |
| 43 | + |
| 44 | +#### Schedule jobs for this cagg, for recent data with high priority |
| 45 | + |
| 46 | +```json |
| 47 | +{ |
| 48 | + "end_offset": "7 days", |
| 49 | + "start_offset": "2 years", |
| 50 | + "continuous_aggregate": "public.stats_five_minutes", |
| 51 | + "increment_size": "1 week", |
| 52 | + "priority": 1 |
| 53 | +} |
| 54 | +``` |
| 55 | + |
| 56 | +```sql |
| 57 | +CALL _timescaledb_additional.schedule_refresh_continuous_aggregate_incremental( |
| 58 | + job_id => null, |
| 59 | + config => $1 |
| 60 | +); |
0 commit comments