Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Current database index nflow_workflow_activation is unoptimal for polling. #329

Closed
jsyrjala opened this issue Jun 7, 2019 · 1 comment
Closed

Comments

@jsyrjala
Copy link
Member

jsyrjala commented Jun 7, 2019

Currently nFlow has this index which is intended to make polling fast.

create index nflow_workflow_activation on nflow_workflow(next_activation, modified);

Now days this doesn't match any more the polling code:
https://github.com/NitorCreations/nflow/blob/master/nflow-engine/src/main/java/io/nflow/engine/internal/dao/WorkflowInstanceDao.java#L516

String whereConditionForInstanceUpdate() {
  return "where executor_id is null and status in (" + sqlVariants.workflowStatus(created) + ", "
      + sqlVariants.workflowStatus(inProgress) + ") and " + sqlVariants.dateLtEqDiff("next_activation", "current_timestamp")
      + " and " + executorInfo.getExecutorGroupCondition() + " order by next_activation asc";
}

There should be an index that is something like this to replace the current index

create index nflow_workflow_activation2 on nflow_workflow (next_activation, executor_id, status, executor_group);
@efonsell
Copy link
Member

Fixed in PR #343

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants