On 9/19/2019 1:23 AM, Vincenzo D'Amore wrote:
talking about how to write solr queries I was investigating if there is a
difference of performance in these two filter queries: field:[* TO *]  or
field:*

In other words:

q=*:*&fq=field:[* TO *]&rows=0

q=*:*&fq=field:*&rows=0

The first one is a range query, the second is a wildcard query.

Ordinarily we strongly recommend against wildcard queries for selecting all documents where a field exists (has a value). For the general case, a range query will be faster.

If the field's cardinality is VERY low, a wildcard query can be fast, and might even be faster than the range query ... but if the field has ten million possible values (terms) in the index, the query that Solr constructs from a wildcard will quite literally contain all ten million of those values, and it will be VERY slow.

Thanks,
Shawn

Reply via email to