This feature is available on versions
0.25.5 and above.ltree path filters or PostGIS spatial filters.
When a useful external index is available, ParadeDB can use it to narrow the candidate rows before returning search results.
Without that external index, ParadeDB still returns correct results, but it checks the specialized filter row by row.
As an example, let’s start with the built-in mock_items table and create a larger example table with one specialized location column.
location, run:
location, ParadeDB finds the text matches first and then checks the location filter row by row.
Now add an index on location that can answer this kind of containment filter.
Bitmap Index Scan.
This means the location filter is no longer being checked row by row. Over large result sets, this results
in a significant reduction in page reads and, consequently, query time improvement.
Limitations
This is an optimization, so ParadeDB will fall back to regular row-by-row filtering when the safer or cheaper path is to avoid the extra index. The most common reasons are:- The filter appears under
ORorNOT. OnlyANDis currently supported. - More than one external index could help. ParadeDB currently chooses the best single external index instead of combining several.
- The filter uses SQL’s
= ANY (...)array form. - The candidate set from the external index is expected to be too large, or the filter is not selective enough to justify the extra work.
EXPLAIN output.