Skip to content

fix(sqlite): batch vector completeness checks - #1640

Merged
Teingi merged 1 commit into
oceanbase:masterfrom
notepix:fix/sqlite-vector-completeness-n-plus-one
Sep 18, 2026
Merged

Teingi merged 1 commit into
oceanbase:masterfrom
notepix:fix/sqlite-vector-completeness-n-plus-one

Conversation

@notepix

@notepix notepix commented Sep 17, 2026

Copy link
Copy Markdown
Contributor

Which issue or RFC does this PR close?

Closes #1631

Rationale for this change

SQLite Vector search performed N+1 physical-vector probes during completeness validation. The validation runs once while selecting the search mode and again immediately before SQLite vector search, causing SQL statement count to grow with the number of active Memory Entries.

What changes are included in this PR?

  • Replace the N+1 physical-vector probes in SQLiteMemoryVectorIndex.vector_complete() with a set-based SQLite query.
  • Add regression coverage for the SQL budget and existing vector-completeness validation behavior.

Are there any user-facing changes?

No API, configuration, or persisted-schema changes.
SQLite Vector search uses fewer database round trips for Memories with many active Entries.

How was this change tested?

  • make check — passed.
  • uv run python -m pytest tests/e2e/test_sqlite_vec.py -q — 8 passed.
  • make unit-test — known failures were reproduced on clean 6ffc5263 master: 49 failed, 135 passed, 1 skipped.
  • make e2e-test — known failures were reproduced on clean 6ffc5263 master: 15 failed, 13 passed.

AI usage statement

OpenAI Codex (GPT-5.6 sol) assisted with regression-test design, reviewed the generated changes and PR content.

@CLAassistant

CLAassistant commented Sep 17, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@notepix
notepix force-pushed the fix/sqlite-vector-completeness-n-plus-one branch from 297180d to 3fe8d7b Compare September 17, 2026 16:22
Comment thread src/powercontext/builtin/persistence/sqlite/memory_index.py
@notepix
notepix force-pushed the fix/sqlite-vector-completeness-n-plus-one branch from 3fe8d7b to a86e178 Compare September 17, 2026 18:02

@Teingi Teingi left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Teingi
Teingi merged commit cd03cef into oceanbase:master Sep 18, 2026
22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug(sqlite): avoid N+1 physical-vector probes during vector completeness checks

3 participants