Trying to build an index for the following query for the object below.
{
_id:“idofdocument”,
book: {
_id: “someBookId”,
name: “NoNamed”
},
seller: {
name: “A Book shop”
},
type: “_recent_seller”,
sold: “timestamp”
}
The requirement is to fetch the recent seller per book.
Query: SELECT book._id as bookId, MAX([sold
,sell])[1].seller AS seller FROM bucker
sell WHERE type=’_recent_seller’ GROUP BY book._id
Index I tried is following which is not covered and is taking 5 seconds to return the data.
create index _idx_recent_seller on bucket(type,book._id,sold) where type = ‘_recent_seller’.
Could you guys help me get this performance improved.