GH-1577 / Optimize FIND_RUNS_WITH_URI query #1580
Labels
area/backend
priority/hold
An issuee that we need to look at - but later
type/enhancement
An enhancement to an existing feature
Long term fix for of #1577
Describe the issue
Right now the query
Horreum/horreum-backend/src/main/java/io/hyperfoil/tools/horreum/svc/RunServiceImpl.java
Lines 91 to 103 in 3849f04
objects searching for
$schema` key.This is the query plan (obtained in local machine using prod backup):
Worth to note that the worst case happens when we are creating a new
Schema
that is not referenced anywhere, as in that case it has to look into every place for every run.Moreover as the number of runs increase, the performance of this query can only get worse.
Describe the solution you'd like
After some discussion we came up to a possible solution which will require a bit of refactoring.
Here a summary of required changes that could speed up the overall process:
run_schemas
table needs to be updated on creation/update of aRun
schemaId
null butschemaUri
set.run_schemas.schemaId
as null and no other parts wil break.run_schemas
table rather than looking into every run'sjsonb
objectrun_schemas
will contain all information that we needrun_schemas
records accordingly, e.g., if we are creating a schema that is referenced there, we should update all records with new id.Additional information
n/a
The text was updated successfully, but these errors were encountered: