Repository navigation
Conversation
운영 VectorSearchQueryService·HybridSearchQueryService를 그대로 호출하고 Repository만 반환 행을 기록하는 Proxy로 감싸, SQL 후보 수와 앱 필터 뒤 최종 건수를 따로 잰다. Exact·현재 계획(Custom/Generic Plan)·HNSW 강제 (ef_search·iterative_scan) 8가지 방식을 같은 Transaction의 SET LOCAL로 바꾼다. - 실제 문서를 운영 Parser·Chunker·Embedding 경로로 처리해 캐시 - 실제 Embedding 방향을 섞는 결정적 합성 확장과 허용 문서 선택 - vector.search.performance.permission.phase 속성이 있을 때만 실행
합성 Vector의 단위 길이·지정 유사도, 결정적 확장, 중첩되는 허용 문서 선택, Recall·백분위 계산을 DB 없이 검증한다.
- 예제 문서 15건·설계 문서 15건으로 만든 고정 질문 30개 - results.json을 CSV·Markdown 표·SVG 그래프로 바꾸는 스크립트 - 운영 findTopK SQL로 Custom/Generic Plan·HNSW 강제 계획을 비교하는 psql 스크립트
- 현재 검색 SQL은 HNSW를 쓰지 않아(조인 9행 오추정) 권한 필터로 결과가 빠지지 않음 - HNSW를 쓰게 하면 H1·H2 재현, iterative relaxed가 대부분 회복 - Generic Plan에서 질문 Vector를 행마다 파싱해 15~21배 느려지는 문제와 해결안 검증
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configuration
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 |
This was referenced Oct 17, 2026
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.
🔍️ 작업 내용
권한이 좁은 사용자일수록 벡터 검색 결과가 빠지는지(H1·H2)를 로컬 격리 pgvector에서 재현하고, 인덱스 방식별로 비교했습니다. 운영 코드·설정·마이그레이션은 바꾸지 않았고, 시험 코드와 결과 기록만 추가합니다.
결과 문서: gimin-#545-permission-filter-vector-recall.md
✨ 상세 설명
가설 판정
documents조인 조건 두 개를 독립으로 봐 조인 결과를 9행으로 추정합니다(실제 50,008행). 그래서 btree + 해시 조인 + top-N 정렬, 즉 사실상 Exact 검색을 고릅니다.plan_cache_mode=auto에서 같은 Statement를 6번째 실행할 때부터 Generic Plan으로 바뀌고,CAST(:queryVector AS vector)를 행마다 다시 파싱합니다. 5만 청크·허용 100%에서 204ms → 4,226ms입니다.(SELECT CAST(... AS vector))로 바꾸면 Generic Plan에서도 162.8ms입니다(psql 검증).측정 조건
pgvector/pgvector:0.8.1-pg17(CI와 같은 digest), PostgreSQL 17.8 기본 설정변경 파일
backend/src/test/.../search/benchmark/PermissionRecall*.java5개test에서 제외되는vector-search-performance태그를 쓰고,vector.search.performance.permission.phase속성이 있을 때만 실행됩니다.PermissionRecallDatasetTest)는 기본test에서 실행됩니다.docs/test-results/gimin-#545-permission-filter-vector-recall.mddocs/test-results/evidence/issue-545/: 질문 세트, 원시 데이터(gzip), 요약 CSV·표, 그래프 2개, psql 실행 계획, 재현 스크립트테스트
./backend/gradlew -p backend test(develop39dbfb9+ 이번 변경, 격리 DB·Valkey): 1,508 tests, 0 failures, 0 errors, 5 skippedPermissionRecallDatasetTest7/7 통과🛠️ 추후 리팩토링 및 고도화 계획
기능테스트(10/28) 이후 별도 [Fix]에서 다시 측정한 뒤 진행할 후보입니다. 이번 PR에서는 적용하지 않았습니다.
hnsw.iterative_scan = relaxed_order필수📸 스크린샷 (선택)
💬 리뷰 요구사항
enable_sort = off로 HNSW를 쓰게 한 것은 실험 장치입니다. 쿼리를 바꿔 HNSW를 쓰게 했을 때의 계획과 다를 수 있습니다.