db.order_lineitem.aggregate([
|
{
|
$match: {
|
$and: [
|
{ "order.o_orderdate": { $gte: ISODate("1992-01-01") } },
|
{ "order.o_orderdate": { $lte: ISODate("1996-01-01") } },
|
]
|
},
|
},
|
{
|
$group: {
|
_id: "$order.o_orderkey",
|
priority: { $last: "$order"},
|
someSum: {
|
$sum: "$l_extendedprice"
|
},
|
anotherSum1: {
|
$sum: "$l_discount"
|
},
|
anotherSum2: {
|
$sum: "$l_tax"
|
},
|
anotherSum3: {
|
$sum: "$l_quantity"
|
},
|
count: { $sum: 1 }
|
}
|
}
|
]
|
)
|
- Investigate perf, see if there's any low-hanging fruit
- if no low hanging fruit, I'd still like to understand where all the time is spent in this query
|