Commit 4f506d4
authored
Optimize time-series source operator (elastic#127095)
This query against the TSDB track took 50 seconds and was reduced to 19 seconds with this changes.
```
TS tsdb
| STATS sum(rate(kubernetes.container.memory.pagefaults)) by bucket(@timestamp, 5minute)
```
This change introduces several optimizations to improve the performance
of the time-series source operator:
- Split the leaf queue into two: one for `_tsid` and another for `@timestamp`.
This avoids repeatedly comparing large `_tsid` values while iterating over a single `_tsid`.
- Track the number of emitted documents per segment and use this data to
build forward and backward document maps, reducing the need for
expensive sorts.
- Use ordinal blocks to avoid duplicating the same `_tsid` multiple times1 parent 53780fe commit 4f506d4
File tree
2 files changed
+268
-171
lines changed- x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute
- data
- lucene
2 files changed
+268
-171
lines changedLines changed: 11 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
67 | 67 | | |
68 | 68 | | |
69 | 69 | | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
70 | 76 | | |
71 | 77 | | |
72 | 78 | | |
| |||
209 | 215 | | |
210 | 216 | | |
211 | 217 | | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
212 | 222 | | |
213 | | - | |
| 223 | + | |
214 | 224 | | |
215 | 225 | | |
216 | 226 | | |
| |||
0 commit comments