[
https://issues.apache.org/jira/browse/SOLR-17131?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Kevin Risden updated SOLR-17131:
--------------------------------
Description:
If a query has rows=0 Solr does not need to sort the results or even compute
the score. This means the filterCache can be more efficient to compute the
result and Solr doesn't spend time on unnecessarily sorting and scoring large
result sets for it to be thrown away.
There is one subtle difference from this change - `maxScore` is no longer
returned if `rows=0` which seems like a reasonable tradeoff. If `maxScore` is
needed then set `rows=1`. `maxScore` can't reliably be compared across searches
anyway so no reason to have it when `rows=0`.
This was found while looking at
https://issues.apache.org/jira/browse/SOLR-14765 and trying to reason through
the case of rows=0 that are sometimes used to just determine count of matching
results. This change adds the check for rows=0 before other checks to ensure
that we can short circuit scoring even if there is a scoring query. We also
don't add the query to the filter cache since that could result in filter cache
thrashing.
In some tests, we found that queries with rows=0 p99 improved by 50% and CPU
dropped by 5%.
was:
If a query has rows=0 Solr does not need to sort the results or even compute
the score. This means the filterCache can be more efficient to compute the
result and Solr doesn't spend time on unnecessarily sorting and scoring large
result sets for it to be thrown away.
This was found while looking at
https://issues.apache.org/jira/browse/SOLR-14765 and trying to reason through
the case of rows=0 that are sometimes used to just determine count of matching
results. This change adds the check for rows=0 before other checks to ensure
that we can short circuit scoring even if there is a scoring query. We also
don't add the query to the filter cache since that could result in filter cache
thrashing.
In some tests, we found that queries with rows=0 p99 improved by 50% and CPU
dropped by 5%.
> Optimize rows=0 queries since score/sort isn't necessary
> --------------------------------------------------------
>
> Key: SOLR-17131
> URL: https://issues.apache.org/jira/browse/SOLR-17131
> Project: Solr
> Issue Type: Improvement
> Security Level: Public(Default Security Level. Issues are Public)
> Reporter: Kevin Risden
> Assignee: Kevin Risden
> Priority: Major
>
> If a query has rows=0 Solr does not need to sort the results or even compute
> the score. This means the filterCache can be more efficient to compute the
> result and Solr doesn't spend time on unnecessarily sorting and scoring large
> result sets for it to be thrown away.
> There is one subtle difference from this change - `maxScore` is no longer
> returned if `rows=0` which seems like a reasonable tradeoff. If `maxScore` is
> needed then set `rows=1`. `maxScore` can't reliably be compared across
> searches anyway so no reason to have it when `rows=0`.
> This was found while looking at
> https://issues.apache.org/jira/browse/SOLR-14765 and trying to reason through
> the case of rows=0 that are sometimes used to just determine count of
> matching results. This change adds the check for rows=0 before other checks
> to ensure that we can short circuit scoring even if there is a scoring query.
> We also don't add the query to the filter cache since that could result in
> filter cache thrashing.
> In some tests, we found that queries with rows=0 p99 improved by 50% and CPU
> dropped by 5%.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]