From e70930dbb2146c9f50ca635f38a7223e0b042fe9 Mon Sep 17 00:00:00 2001 From: Thodoris Greasidis Date: Wed, 10 May 2023 16:42:31 +0300 Subject: [PATCH] Optimize the unique release_version rule Enables row narrowing when the rule is triggered by application changes, but more importantly allows bC to rewrite the rule using a GROUP BY. Also reduces slightly the full rule runtime from ~200ms to ~180ms. Change-type: patch See: https://explain.dalibo.com/plan/978hb14b2dd56ccb See: https://explain.dalibo.com/plan/6f1hd8f4ee0ada6d --- src/balena.sbvr | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/balena.sbvr b/src/balena.sbvr index d95b045ed..e1b1e1eab 100644 --- a/src/balena.sbvr +++ b/src/balena.sbvr @@ -846,7 +846,7 @@ Fact Type: scheduled job run has status -- Rules -Rule: It is necessary that each release that has a release version1 and has a status that is equal to "success" and is not invalidated, belongs to an application that owns exactly one release that has a release version2 that is equal to the release version1 and has a status that is equal to "success" and is not invalidated. +Rule: It is necessary that each application that owns a release1 that has a status that is equal to "success" and is not invalidated and has a release version, owns at most one release2 that has a status that is equal to "success" and is not invalidated and has a release version that is of the release1. Rule: It is necessary that each image that has a status that is equal to "success", has a push timestamp. Rule: It is necessary that each application that owns a release1 that has a status that is equal to "success" and has a commit1, owns at most one release2 that has a status that is equal to "success" and has a commit2 that is equal to the commit1. Rule: It is necessary that each application that owns a release1 that has a revision, owns at most one release2 that has a semver major that is of the release1 and has a semver minor that is of the release1 and has a semver patch that is of the release1 and has a semver prerelease that is of the release1 and has a variant that is of the release1 and has a revision that is of the release1.