You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Lucene suffix wildcard field queries should compile to prefix predicates in ClickHouse #2296
Lucene suffix wildcard field queries semantically represent a prefix match. For example:
app:frontend.*
This should behave like values where app starts with frontend..
When HyperDX renders this kind of Lucene query to ClickHouse SQL, it appears to compile to a contains-style predicate instead of a prefix predicate, e.g.:
app ILIKE '%frontend.%'
For ClickHouse-backed log tables, this is much slower than preserving prefix semantics with something like:
startsWith(app, 'frontend.')
-- or
app LIKE'frontend.%'
Why this matters
On large ClickHouse log tables ordered by a low-cardinality service/application field plus timestamp, prefix predicates can significantly reduce the scan range. Compiling a suffix-only Lucene wildcard into a contains predicate prevents effective primary key / ordering pruning and can make common saved searches much slower.
Example
Lucene query:
app:frontend.* AND environment:prod
Expected ClickHouse rendering:
startsWith(app, 'frontend.') AND environment ='prod'
or:
app LIKE'frontend.%'AND environment ='prod'
Actual behavior appears to be closer to:
app ILIKE '%frontend.%'AND environment ='prod'
Suggested behavior
When a Lucene field term has only a trailing wildcard, e.g. field:value*, render it as a ClickHouse prefix predicate instead of a contains predicate.
Leading wildcard queries such as field:*value or contains wildcard queries such as field:*value* can continue to use contains-style predicates.
Notes
This is not about implicit full-text search. It is specifically about explicit field queries with a suffix-only wildcard.
Activity
pulpdrew commentedon May 18, 2026
Hi @qcrin, you can achieve prefix search on fields with
app:(frontend.*)qcrin commentedon May 24, 2026
Thanks @pulpdrew, that works for our use case. We'll update our saved searches to use
app:(frontend.*)It may be useful to document this syntax.