PostgreSQL:FTS
lastmod 2025-04-10created 2024-08-165 edits
Full-text search (FTS) in PostgreSQL.
Example
-- 테이블 생성 및 데이터 삽입
CREATE TABLE documents (id SERIAL PRIMARY KEY, content TEXT);
INSERT INTO documents (content) VALUES
('Python은 강력한 프로그래밍 언어입니다.'),
('데이터 분석과 머신러닝에 적합합니다.');
-- 전문 검색
SELECT * FROM documents
WHERE to_tsvector('korean', content) @@ to_tsquery('korean', 'Python');
See also
Favorite site
- [Original] PostgreSQL BM25 Full-Text Search: Speed Up Performance with These Tips
- With a tsvector column and a proper GIN index (fastupdate=off), even the built-in FTS can search very fast
- Performance comparisons should be made against an optimized baseline
- If advanced ranking features are needed, consider extensions such as VectorChord-BM25
- Key message: the tool may not be slow; the configuration may be the problem