hello guys
I have a bucket with billions of data, and for our case, it is somewhat impossible to add an extra index in the bucket. the pattern of all keys are like bellow
m_categoryId_id
and the only thing I need is to select m_categoryId_* from the bucket.
as I saw in Couchbase (v5) web console dashboard, it can found by bellow url very fast.
If the id portion of your m_categoryId_id key is not constrained in any way, you’ll have to go with the N1QL approach. But if the id were a sequence number or some other value known at lookup-time you could use the Java SDK to grab them by ID.
the id not generated by me, it is incremental (starts by 1) but it is somewhat sparse on deleted items (maybe the gap is huge ). with some consideration and store maximum of each categoryId, your solution is very nice and fast.
thanks
Great! If you have to repeatedly fetch these documents, you could keep track of the gaps you encounter in another document and use that information to avoid unnecessary lookups.