Conversation
- Refactor `db_models_load` to retrieve the most recent models first with a limit and sort them ascending by `after`.
There was a problem hiding this comment.
Pull request overview
Updates ML model initialization to load only a limited number of recent models from the SQLite models table, aiming to reduce startup DB work while keeping models in chronological order for processing.
Changes:
- Refactors the
db_models_loadSQL to select the latest N models (via a DESC + LIMIT subquery) and then order them ASC for processing. - Binds
Cfg.num_models_to_useinto the load query as@n.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…estamp for improved model ordering consistency.
There was a problem hiding this comment.
1 issue found across 1 file (changes from recent commits).
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="src/ml/ml.cc">
<violation number="1" location="src/ml/ml.cc:176">
P2: Ordering by `before` in the inner top-N query is not supported by the existing index and can force a full sort before `LIMIT`, causing unnecessary DB overhead.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
thiagoftsm
left a comment
There was a problem hiding this comment.
After changes, PR is working as expected. LGTM!
Summary
Summary by cubic
Load only the most recent ML models up to the configured limit to speed up initialization and reduce DB work.
db_models_loadto select explicit columns, fetch the N newest via subquery (ORDER BY after DESC LIMIT @n), then return them sorted byafterASC.Cfg.num_models_to_useas@nand tidyml_dimension_stream_kmeansindentation.Written for commit 17c8239. Summary will update on new commits.