Skip to content
Search

Biscuit

lastmod 2026-01-08created 2026-01-081 edits

A dedicated index for speeding up LIKE / ILIKE pattern search in PostgreSQL

About

  • A PostgreSQL-specific index access method (IAM) designed to quickly handle string searches with many wildcards
    • Addresses the limitations of pg_trgm, which structurally incurs unnecessary heap access and performance loss
  • Uses a Bitmap Position Index based on characters and positions to filter candidate results exactly with in-memory bitmap operations
    • No heap recheck is needed for search results, eliminating unnecessary random I/O
  • Handles prefix, suffix, and substring patterns efficiently through a bidirectional (positive / negative) index structure that indexes both the front and back positions of strings
  • Internally separates a dedicated ILIKE index path for case-insensitive search, securing both correctness and performance
  • Designed to handle not only single-column but also multi-column LIKE conditions with a single index
    • Analyzes the pattern selectivity of each column and automatically reorders execution
  • Provides deterministic search results with no false positives, even for complex patterns mixing % and _
  • Improves processing speed by skipping unnecessary sorting even for aggregate queries such as COUNT and EXISTS
  • Implemented on Roaring Bitmap (CRoaring), automatically optimizing memory usage according to data density
  • Does not support ORDER BY directly, but works naturally with the planner so that sorting happens after the result set has shrunk
  • Does not support regular expressions, similarity search, or locale-based collation; instead the design focuses on LIKE / ILIKE-specific performance

See also

Favorite site

author Zer0 sitemap