Skip to content

Commit 8e8475a

Browse files
author
Vladimir Ershov
committed
add indexes
1 parent ec6d647 commit 8e8475a

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

pgpro_scheduler--2.0.sql

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ CREATE TABLE at_jobs_submitted(
2626
submit_time timestamp with time zone default now()
2727
);
2828
CREATE INDEX ON at_jobs_submitted(at,submit_time);
29+
CREATE INDEX ON at_jobs_submitted (last_start_available, node);
2930

3031
CREATE TABLE at_jobs_process(
3132
start_time timestamp with time zone default now()
@@ -66,6 +67,7 @@ CREATE TABLE cron(
6667
reason text,
6768
_next_exec_time timestamp with time zone
6869
);
70+
create index on cron (node);
6971

7072
CREATE TABLE at(
7173
start_at timestamp with time zone,

src/scheduler_manager.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1492,6 +1492,7 @@ void manager_worker_main(Datum arg)
14921492
ctx = initialize_scheduler_manager_context(database, seg);
14931493
clean_at_table(ctx);
14941494
set_slots_stat_report(ctx);
1495+
SetConfigOption("enable_seqscan", "off", PGC_USERSET, PGC_S_SESSION);
14951496

14961497
while(!got_sigterm)
14971498
{
@@ -1509,7 +1510,7 @@ void manager_worker_main(Datum arg)
15091510
if(!got_sighup && !got_sigterm)
15101511
{
15111512
terminate_main_loop = 0;
1512-
while(1)
1513+
while(!got_sighup && !got_sigterm)
15131514
{
15141515
wait = 0;
15151516
if(check_parent_stop_signal(ctx))
@@ -1521,11 +1522,12 @@ void manager_worker_main(Datum arg)
15211522
wait += scheduler_start_jobs(ctx, CronJob);
15221523
scheduler_check_slots(ctx, &(ctx->at));
15231524
scheduler_check_slots(ctx, &(ctx->cron));
1524-
set_slots_stat_report(ctx);
1525+
scheduler_make_atcron_record(ctx);
1526+
/* set_slots_stat_report(ctx); */
15251527
if(wait == 0) break;
15261528
}
15271529
if(terminate_main_loop) break;
1528-
scheduler_make_atcron_record(ctx);
1530+
set_slots_stat_report(ctx);
15291531
/* if there are any expired jobs to get rid of */
15301532
scheduler_vanish_expired_jobs(ctx, AtJob);
15311533
scheduler_vanish_expired_jobs(ctx, CronJob);

0 commit comments

Comments
 (0)