fix for add from pool bug (long loading time) mantis 47724#11821
Open
mglaubitz wants to merge 1 commit into
Open
fix for add from pool bug (long loading time) mantis 47724#11821mglaubitz wants to merge 1 commit into
mglaubitz wants to merge 1 commit into
Conversation
… index
The 'Add from pool' question browser (ilObjTestGUI -> ilTestQuestionBrowserTableGUI
-> ilAssQuestionList::load) built one large query with 7 correlated EXISTS
subqueries (feedback x4, hints, taxonomies) as SELECT fields. These were
evaluated for every candidate row BEFORE ORDER BY/LIMIT, so on large
instances (bug report: ~199k rows) the query ran 30-40 min and blocked
other queries.
Fix: when a Range is set and neither a HAVING filter nor an ORDER BY on a
computed column (feedback/hints/taxonomies) is active, load in two phases:
Phase A: SELECT question_id + required JOINs/filters + GROUP BY +
ORDER BY + LIMIT (no EXISTS subqueries) -> small paginated id set
Phase B: full SELECT incl. feedback/hints/taxonomies EXISTS, restricted
to the paginated ids via IN (...) -> flags computed only for the
~800 visible rows instead of the full candidate set.
Fallback to the original single-phase query for: no range, HAVING filter
(feedback/hints = true|false), ORDER BY feedback/hints/taxonomies.
buildOrderQueryExpression now qualifies columns for phase A (qpl_questions.*
not selected -> ambiguous title) and backticks qualified names per segment
(`qpl_questions`.`title`).
Adds composite index i6 (obj_fi, original_id, title) on qpl_questions
via ilTestQuestionPool10DBUpdateSteps::step_3() to support the phase A
filter (obj_fi IN ... AND original_id IS NULL) + default title ordering.
Adds ilAssQuestionListTwoPhaseTest (15 tests) covering the two-phase path,
all fallback conditions, column qualification and SQL shape.
Verified with EXPLAIN against the local docker DB: phase A has no
DEPENDENT SUBQUERY (3 simple JOINs only), phase B's subqueries are
evaluated over rows=2 (paginated set) instead of the full candidate set.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
we let one of our local AI models (GLM 5.2) analyse the problem and create a bug fix. this reduces loading time on ourt exam-test server from 3.6 minutes to 6.2 seconds (!)