fix: rewrite queries for checking child workflows (#983)

* rewrite queries for child workflows

* add index

* fix: remove tenant id where it's not needed
This commit is contained in:
abelanger5
2024-10-23 19:18:26 -04:00
committed by GitHub
parent dd5bc90497
commit 718d8f59c9
9 changed files with 71 additions and 121 deletions

View File

@@ -32,3 +32,8 @@ ON "WorkflowTriggers" ("workflowVersionId");
-- Additional indexes on WorkflowTriggerEventRef
CREATE INDEX idx_workflow_trigger_event_ref_event_key_parent_id
ON "WorkflowTriggerEventRef" ("eventKey", "parentId");
-- Additional indexes on WorkflowRun
CREATE INDEX CONCURRENTLY IF NOT EXISTS "WorkflowRun_parentId_parentStepRunId_childIndex_key"
ON "WorkflowRun"("parentId", "parentStepRunId", "childIndex")
WHERE "deletedAt" IS NULL;

View File

@@ -0,0 +1,6 @@
-- atlas:txmode none
-- Create index "WorkflowRun_parentId_parentStepRunId_childIndex_key" to table: "WorkflowRun"
CREATE INDEX CONCURRENTLY IF NOT EXISTS "WorkflowRun_parentId_parentStepRunId_childIndex_key"
ON "WorkflowRun" ("parentId", "parentStepRunId", "childIndex")
WHERE ("deletedAt" IS NULL);

View File

@@ -1,4 +1,4 @@
h1:lNjyxVX0eSBxZnBeGyc4VtrjBez24XAQ9K779KQzVNE=
h1:CIM7NAv26L+YhyBC6tFMerwS5zoQM4Nxj2gERfvn1i0=
20240115180414_init.sql h1:Ef3ZyjAHkmJPdGF/dEWCahbwgcg6uGJKnDxW2JCRi2k=
20240122014727_v0_6_0.sql h1:o/LdlteAeFgoHJ3e/M4Xnghqt9826IE/Y/h0q95Acuo=
20240126235456_v0_7_0.sql h1:KiVzt/hXgQ6esbdC6OMJOOWuYEXmy1yeCpmsVAHTFKs=
@@ -70,3 +70,4 @@ h1:lNjyxVX0eSBxZnBeGyc4VtrjBez24XAQ9K779KQzVNE=
20241018142125_v0.50.1.sql h1:j0fNH72m40gU3v5e8XolQIALBm4Te0/I8uvezcZ5EbU=
20241022124210_v0.50.2.sql h1:UerCQiYQTz9dC4EvuOiPH2afsL/ORa8fZt71K9uGDyU=
20241023112235_v0.50.3.sql h1:aW7fMNTT9o3gg8TJhDM3juB/tWho3j9M6VYsbMqSNcw=
20241023223039_v0.50.4.sql h1:eXJLlkM6ZzqzZ4RbAZtoTiW7WjJPIJ5L6UkIKy6w9Uk=

View File

@@ -1666,3 +1666,8 @@ ON "WorkflowTriggers" ("workflowVersionId");
-- Additional indexes on WorkflowTriggerEventRef
CREATE INDEX idx_workflow_trigger_event_ref_event_key_parent_id
ON "WorkflowTriggerEventRef" ("eventKey", "parentId");
-- Additional indexes on WorkflowRun
CREATE INDEX CONCURRENTLY IF NOT EXISTS "WorkflowRun_parentId_parentStepRunId_childIndex_key"
ON "WorkflowRun"("parentId", "parentStepRunId", "childIndex")
WHERE "deletedAt" IS NULL;