-
Notifications
You must be signed in to change notification settings - Fork 414
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add optimization for pure count and count aggregation #5032
Comments
@PSeitz can you take over this issue. You can ditch or use #5034 if you want. Problem 1) Problem 2) Problem 3) ======== Other optim opportunity We could directly operate over values, instead of filling a doc id buffer, and fetching those. |
Count All
Implemented here: Count All + Top N
To support Implemented here: Count All + Top N + Sort By DateThis optimization could also be extended Identify splits which can't contain data from the top n, with the time_range metadata: /// If a timestamp field is available, the min / max timestamp in
/// the split, expressed in seconds.
pub time_range: Option<RangeInclusive<i64>>, Implemented here: Count All + Top N + (Sort By Date) + Time Range Query#5048 implements this, but we could also do some early detection which splits will deliver enough results by extending #5075 Implemented here: Count All + Top N + Sort By Other FieldWe don't have metadata for other fields on the split metadata, so there are two options:
Not implemented |
I could not tell if your text is describing the current state or not. In that case, the optimization in main won't kick in. The idea is that if a split is entirely within the range query, we transform the range query into an all query. |
* optimization requests by passing threshold in leaf search * Execute query.count() instead of QuickwitCollector for count searches We have 100 concurrent split searches by default, but num_cpus worker threads. This means most search futures will wait to be scheduled. When they are scheduled they can check the new threshold from the preceding searches and maybe skip the search. Switches to RWLock for the threshold since we read more often now. Future Work: We run num_cpu full searches in some cases before the threshold kicks in. But in some cases we could statically analyze from which split the best results come and generate count only requests for the others. Addresses #5032
* optimization requests by passing threshold in leaf search * Execute query.count() instead of QuickwitCollector for count searches We have 100 concurrent split searches by default, but num_cpus worker threads. This means most search futures will wait to be scheduled. When they are scheduled they can check the new threshold from the preceding searches and maybe skip the search. Switches to RWLock for the threshold since we read more often now. Future Work: We run num_cpu full searches in some cases before the threshold kicks in. But in some cases we could statically analyze from which split the best results come and generate count only requests for the others. Addresses #5032
* optimization requests by passing threshold in leaf search * Execute query.count() instead of QuickwitCollector for count searches We have 100 concurrent split searches by default, but num_cpus worker threads. This means most search futures will wait to be scheduled. When they are scheduled they can check the new threshold from the preceding searches and maybe skip the search. Switches to RWLock for the threshold since we read more often now. Future Work: We run num_cpu full searches in some cases before the threshold kicks in. But in some cases we could statically analyze from which split the best results come and generate count only requests for the others. Addresses #5032
* count optimization for multisplits * optimization requests by passing threshold in leaf search * Execute query.count() instead of QuickwitCollector for count searches We have 100 concurrent split searches by default, but num_cpus worker threads. This means most search futures will wait to be scheduled. When they are scheduled they can check the new threshold from the preceding searches and maybe skip the search. Switches to RWLock for the threshold since we read more often now. Future Work: We run num_cpu full searches in some cases before the threshold kicks in. But in some cases we could statically analyze from which split the best results come and generate count only requests for the others. Addresses #5032 * add comments
I update the comment to make it more clear on the current state implemented. On using the term dictionary for aggregations, this would only work if the same tokenizer is used (which isn't the case by default). In the fast field dictionary we don't store counts currently. It's also quite special, e.g. it would not support any nested aggregations. Given how special it is and how easily cache-able the query is, I'm not sure the payoff is high enough to add a new code path in the aggregations for this.
I think we could detect if an incoming block of docids is contiguous in |
as observed on airmail
We are slower than Opensearch on
_count
on AllQuery_count
queries on termqueriesAllQuery
like the one as followsAll of the above can be addressed just looking at the split metadata, and/or the termdictionary.
The text was updated successfully, but these errors were encountered: