Generate date ranges in a way that is more friendly to the cache.#20115
Generate date ranges in a way that is more friendly to the cache.#20115jpountz wants to merge 3 commits intoelastic:masterfrom
Conversation
This commit uses rounding in order to improve the cacheability of date ranges. For instance, `[now-1M TO now]` would actually be parsed as `[now-1M TO now-1M/H] OR [now-1M/H TO now/H] OR [now/H TO now]`. The clause in the middle of the disjunction has rounded bounds, which makes it more likely to be cached. The two outer clauses are unlikely to get cached, but since the match less than one hour of data each, they should execute quickly anyway. In the case that the range query is already rounded at a granularity greater than or equal to one hour, the query is left as-is. So for instance, this query: `[now-2M/d TO now/d]` would be executed as-as without being split in 3 components like the previous query. Closes elastic#20106
|
We discussed about the fact that it might slow down random ranges in FixitFriday. The plan is to first make sure the slow down is contained, and if this is the case merge the change as-is and work on a fix if we later get evidence that there are actual use-cases that this change hurts. |
|
I did some benchmarking on the However if I search for Since it's generally better to speed up slow queries, I'm leaning towards not merging this PR. I'll leave it open for some time for discussion if anybody wants to. |
- use auto-generated ids for indexing elastic#20211 - use rounded dates in queries elastic#20115
This commit uses rounding in order to improve the cacheability of date ranges.
For instance,
[now-1M TO now]would actually be parsed as[now-1M TO now-1M/H] OR [now-1M/H TO now/H] OR [now/H TO now]. The clause inthe middle of the disjunction has rounded bounds, which makes it more likely to
be cached. The two outer clauses are unlikely to get cached, but since the match
less than one hour of data each, they should execute quickly anyway.
In the case that the range query is already rounded at a granularity greater
than or equal to one hour, the query is left as-is. So for instance, this query:
[now-2M/d TO now/d]would be executed as-is without being split in 3components like the previous query.
Closes #20106