Repository navigation
perf(search): CCIP pgvector HNSW index (#626) - #628
Conversation
Add cosine HNSW indexing for CCIP embeddings and structured timing logs for candidate search, media loading, and Rust reranking. Document the production benchmark procedure for EXPLAIN ANALYZE, ef_search, and latency percentiles. Fixes #626
|
Warning Review limit reached
Next review available in: 48 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (5)
📝 WalkthroughWalkthroughCCIPのpgvector検索にコサイン距離用HNSWインデックスを追加し、候補取得・media取得・Rust再ランキングの実行時間と件数をログ出力する計測を導入した。あわせてDrizzleメタデータとベンチマーク手順を更新した。 ChangesCCIP pgvector検索
Estimated code review effort: 3 (Moderate) | ~20 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@apps/server/drizzle/0019_purple_devos.sql`:
- Line 1: Update the idx_ccip_embeddings_embedding_cosine HNSW index creation to
use CREATE INDEX CONCURRENTLY, and configure the migration/deployment procedure
to execute it outside a transaction.
In `@apps/server/src/application/services/ccip-vector-service.ts`:
- Line 6: Remove the direct infrastructure logger import from the CCIP vector
service factory and preserve the dependency direction by accepting an ILogger
through composition-root injection. Update the factory and its callers to pass
the injected logger, or move the factory to infrastructure/bootstrap only if
that better matches its responsibilities.
In `@packages/db/src/schema.ts`:
- Around line 275-277: Update packages/db/src/schema.ts lines 275-277 around
embeddingCosineIndex to use a filtered-vector-search design that reliably
returns the requested count for model/version filters, such as an appropriate
partial index, partitioning, or iterative scan configuration. Update
docs/design/ccip-pgvector-benchmark.md lines 12-32 to compare cases including
source, exact-search differences, returned counts, and whether iterative scan is
enabled.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 871b8950-9aea-44ef-a319-e80e273398ee
📒 Files selected for processing (8)
apps/server/drizzle/0019_purple_devos.sqlapps/server/drizzle/meta/0019_snapshot.jsonapps/server/drizzle/meta/_journal.jsonapps/server/src/application/services/ccip-vector-service.tsapps/server/src/infrastructure/ai/postgres-ccip-vector-store.tsdocs/design/ccip-pgvector-benchmark.mdpackages/application/src/services/ccip-vector-service.tspackages/db/src/schema.ts
概要
Issue #626 の CCIP 類似検索を pgvector の HNSW index と構造化計測ログで改善します。
変更内容
検証
本番相当の約88k vectorsでの実測値は、利用可能なDB接続がないため未取得です。
Fixes #626
Summary by CodeRabbit
改善
ドキュメント