Skip to content

Commit f3df223

Browse files
tweak
1 parent c899635 commit f3df223

File tree

3 files changed

+14
-10
lines changed

3 files changed

+14
-10
lines changed

utils/cagg_refresh_producer_consumer/consumer.sql

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ BEGIN
1616
SET LOCAL lock_timeout TO '1 min';
1717

1818
-- Prevent a hot loop
19-
PERFORM pg_catalog.pg_sleep(0.9);
19+
PERFORM pg_catalog.pg_sleep(0.2);
2020

2121
DECLARE
2222
p_id bigint;
@@ -104,11 +104,13 @@ BEGIN
104104
id = p_id;
105105
COMMIT;
106106

107-
RAISE NOTICE 'Processing %, (% - %)', p_cagg, p_window_start, p_window_end;
107+
RAISE NOTICE
108+
'% - Processing %, (% - %)',
109+
pg_catalog.to_char(pg_catalog.clock_timestamp(), 'YYYY-MM-DD HH24:MI:SS.FF3OF'),
110+
p_cagg,
111+
p_window_start,
112+
p_window_end;
108113
END;
109-
110-
RAISE NOTICE 'Hi!';
111-
PERFORM pg_catalog.pg_sleep(1);
112114
END LOOP;
113115

114116
RAISE NOTICE 'Shutting down worker, as we exceeded our maximum runtime (%)', max_runtime;

utils/cagg_refresh_producer_consumer/example.sql

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,4 @@ CALL _timescaledb_additional.schedule_refresh_continuous_aggregate_incremental(
1111
}'
1212
);
1313

14-
CALL _timescaledb_additional.task_refresh_continuous_aggregate_incremental_runner(
15-
job_id => null,
16-
config =>'{"max_runtime": "3 minutes"}'
17-
);
14+
--CALL _timescaledb_additional.task_refresh_continuous_aggregate_incremental_runner(null, null);

utils/cagg_refresh_producer_consumer/producer.sql

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,12 @@ CREATE UNIQUE INDEX IF NOT EXISTS incr_cagg_refreshes_distinct_tasks_unq ON _tim
3232
window_end
3333
) WHERE worker_pid IS NULL AND finished IS NULL;
3434

35-
CREATE INDEX IF NOT EXISTS incr_cagg_refreshes_active_workers ON _timescaledb_additional.incremental_continuous_aggregate_refreshes(
35+
CREATE INDEX IF NOT EXISTS incr_cagg_refreshes_find_first_work_item_idx ON _timescaledb_additional.incremental_continuous_aggregate_refreshes(
36+
priority,
37+
scheduled
38+
) WHERE worker_pid IS NULL;
39+
40+
CREATE INDEX IF NOT EXISTS incr_cagg_refreshes_active_workers_idx ON _timescaledb_additional.incremental_continuous_aggregate_refreshes(
3641
worker_pid
3742
) WHERE worker_pid IS NOT NULL;
3843

0 commit comments

Comments
 (0)