[ 
https://issues.apache.org/jira/browse/OAK-2007?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14079298#comment-14079298
 ] 

Amit Jain commented on OAK-2007:
--------------------------------

With the index hint the query uses the index on the {{_id}} and without which 
it does not.
{code}
> db.blobs.find({lastMod : {$lte :1406726400279}}, {_id:1}).explain()
{
        "cursor" : "BasicCursor",
        "isMultiKey" : false,
        "n" : 14,
        "nscannedObjects" : 3236,
        "nscanned" : 3236,
        "nscannedObjectsAllPlans" : 3236,
        "nscannedAllPlans" : 3236,
        "scanAndOrder" : false,
        "indexOnly" : false,
        "nYields" : 25,
        "nChunkSkips" : 0,
        "millis" : 18,
        "server" : "amjain-W7-1:27017",
        "filterSet" : false
}
> db.blobs.find({lastMod : {$lte :1406726400279}}, 
> {_id:1}).hint({_id:1}).explain()
{
        "cursor" : "BtreeCursor _id_",
        "isMultiKey" : false,
        "n" : 14,
        "nscannedObjects" : 3399,
        "nscanned" : 3399,
        "nscannedObjectsAllPlans" : 3399,
        "nscannedAllPlans" : 3399,
        "scanAndOrder" : false,
        "indexOnly" : false,
        "nYields" : 26,
        "nChunkSkips" : 0,
        "millis" : 38,
        "indexBounds" : {
                "_id" : [
                        [
                                {
                                        "$minElement" : 1
                                },
                                {
                                        "$maxElement" : 1
                                }
                        ]
                ]
        },
        "server" : "amjain-W7-1:27017",
        "filterSet" : false
}
{code}

I think the problem is that with the {{lastMod}} condition, the {{_id}} index 
does not cover the query any more and I am not sure how much an index on 
{{lastMod}} would  help, because it would still not cover the query. It might 
be better to have a compound index of the form {code}{lastMod:1, id:1}{code}
I am not sure of the impact on performance if any on insert performance though.

> MongoBlobStore improvements
> ---------------------------
>
>                 Key: OAK-2007
>                 URL: https://issues.apache.org/jira/browse/OAK-2007
>             Project: Jackrabbit Oak
>          Issue Type: Improvement
>          Components: blob, mongomk
>    Affects Versions: 1.0.2
>            Reporter: Przemo Pakulski
>         Attachments: OAK-2007.patch
>
>
> To collect all chunk identifiers (getAllChunkIds) hint is used to force "_id" 
> index usage. 
> This index doesn't help because query is using "lastMod" field. It also 
> doesn't allow to leverage custom indexes if created. In result queries are 
> pretty slow.
> Additionally consider to create index on "lastMod" field to speed-up all 
> queries using this criteria.



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to