# pg_bm25 - Postgres에서 Elastic 수준의 품질을 제공하는 Full-Text 검색 확장

> Clean Markdown view of GeekNews topic #11287. Use the original source for factual precision when an external source URL is present.

## Metadata

- GeekNews HTML: [https://news.hada.io/topic?id=11287](https://news.hada.io/topic?id=11287)
- GeekNews Markdown: [https://news.hada.io/topic/11287.md](https://news.hada.io/topic/11287.md)
- Type: news
- Author: [xguru](https://news.hada.io/@xguru)
- Published: 2023-10-11T11:04:01+09:00
- Updated: 2023-10-11T11:04:01+09:00
- Original source: [docs.paradedb.com](https://docs.paradedb.com/blog/introducing_bm25)
- Points: 27
- Comments: 3

## Topic Body

- Rust 기반의 Postgres 확장으로 Full Text 검색을 향상시켜줌   
- 최신 검색 엔진들이 이용하는 BM25 알고리듬(검색 결과의 관련성 점수를 계산) 기반   
- 현재 Postgres 가 사용하는 tsvector 기반 검색은 2개의 문제가 있음  
  - 성능 : 대규모 테이블에서의 검색이 느림  
  - 기능 : 퍼지 검색, 연관성 튜닝 또는 BM25 연관성 점수 등의 작업을 지원하지 않음  
- Postgres 와 ElasticSearch 간의 검색 기능 사이의 간극(Gap)을 메워 ElasticSearch 같은 서비스를 데이터스택에 가져올 필요가 없도록 하는게 목표   
- pg_bm25 의 기능들   
  - 100% Postgres Native. 외부 의존성 없음   
  - Rust 기반의 아파치 Lucene 대체제인 Tantivy 기반   
  - 1백만 Row 이상에 대해서 Postgres의 기본 검색/정렬 함수인 tsquery/ts_rank에 비해 20배 빠름   
  - 퍼지 검색, 어그리게이션, 하이라이팅, 연관성 튜닝 지원   
  - ElasticSearch가 사용하는 BM25 알고리듬을 사용한 연관성 점수   
  - 실시간 검색 : 새로운 데이터가 수동 리인덱싱 없이 즉시 검색 가능

## Comments



### Comment 19846

- Author: secret3056
- Created: 2023-10-13T09:48:26+09:00
- Points: 1

아직 영어만 지원되는듯하고 문서에는 chinese_compatible 토크나이저가 작업중이라고 합니다.  
추가적으로 도커 이미지 사이즈가 꽤 크네요. 거의 8GB인데, 순정 포스트그레스 이미지가 400MB가 안되는걸 보면 대체 위에다 뭘 올린건지...

### Comment 19844

- Author: cosine20
- Created: 2023-10-13T09:08:04+09:00
- Points: 1

좋네요...!

### Comment 19819

- Author: wnswl
- Created: 2023-10-11T21:59:22+09:00
- Points: 1

어서 RDS 같은 관리형 DBMS 들에서 지원해주면 좋겠네요!
