-
Type:
Improvement
-
Resolution: Fixed
-
Priority:
Major - P3
-
Affects Version/s: None
-
Component/s: Query Planning
-
None
-
Fully Compatible
-
Query Optimization 2021-05-03
-
None
-
None
-
None
-
None
-
None
-
None
-
None
For a time-series collection, we automatically bucket fields and have a control block with the min and max of each, like so:
{ _id: ObjectId(...),
control: {
version: 1, // in case we want to change the format in a later release
min: { _id: ..., time: ISODate("2020-09-09T16:54:04.174Z"), field0: 0.01, ... },
max: { _id: ..., time: ISODate("2020-09-09T16:54:04.450Z"), field0: 0.99, ... },
},
meta: ...,
data: { _id: { 0:..., 1: ..., ...},
time: { 0: ISODate("2020-09-09T16:54:04.174Z"),
1: ISODate("2020-09-09T16:54:04.450Z"), ...},
field0: { 0: 0.99, 1: 0.01,...},
field1: { 2: "high", 42: "low",...}, // Missing fields are omitted
...}
}
For a query over that collection like this:
db.example.aggregate([{$group: {_id: "$meta.x", field0: {$max: "$field0"}}}])
We should be able to avoid unpacking or looking at "data" at all.
- is related to
-
SERVER-55624 Track materialized counts and sums for time-series measurements
-
- Closed
-