Issue Summary

I am trying to fire the same query from redash and NoSQLBooster on the same mongodb instance. The query fired from redash is taking much more time, almost 3/4x more, to produce results and it’s same across any type of query i had tried, and i have tried more than 10, 15 queries on different collections to validate this scenario.
FYI, the user collection size 27k docs and branch collection about 25 docs, for which NoSQLBooster takes about 1 sec and redash about 4 sec for this particular query.

{
    "collection": "user",
    "aggregate": [
        {
            "$match": {
                "approvalStatus": 1,
                "grade.id::filter": {
                    "$nin": [
                        "list of mongodb Object IDs"
                    ]
                },
                "isArchived": false
            }
        },
        {
            "$lookup": {
                "from": "Branch",
                "let": {
                    "pid": "$branchId"
                },
                "pipeline": [
                    {
                        "$match": {
                            "$expr": {
                                "$eq": [
                                    "$_id",
                                    {
                                        "$toObjectId": "$$pid"
                                    }
                                ]
                            }
                        }
                    },
                    {
                        "$project": {
                            "name": 1,
                            "_id": 0
                        }
                    }
                ],
                "as": "branch"
            }
        },
        {
            "$unwind": "$branch"
        },
        {
            "$replaceRoot": {
                "newRoot": {
                    "$mergeObjects": [
                        {
                            "branch": "$branch.name"
                        },
                        "$branch"
                    ]
                }
            }
        },
        {
            "$project": {
                "_id": 1,
                "branchName": "$branch"
            }
        },
        {
            "$group": {
                "_id": "$branchName",
                "count": {
                    "$sum": 1
                }
            }
        }
    ]
}

If not any solution, any suggestions to help me debug the situation could be great.

Technical details:

  • Redash Version: 8.0.2+b37747 (a9d7ca43)
  • Browser/OS: Chrome - 98.0.4758.80 (Official Build) (64-bit) / Lubuntu 18.04.6 LTS
  • How did you install Redash: Via Helm chart available in Rancher