Join query is very slow

I use join query like this:

SELECT dex.id AS _k
FROM `cms-data` col_data
    JOIN `cms-deploy-dev` dex ON dex.id = col_data.id
    AND dex.status IN ['active', 'old']
    AND dex.`hash` = col_data.`hash`
    AND dex._scope='rollingslots'
    AND dex._type='game'
WHERE col_data._scope='data'
    AND col_data._type='game'

Indexes in use are:

CREATE INDEX Index_id ON cms-data(id)
CREATE INDEX Index_Type_scope ON cms-data(_type,_scope)
CREATE INDEX Index_status_id_hash ON cms-deploy-dev(status,id,hash)

Index Rate: 100%
Doscs: 2071
Execution time is 46s !!!
Please tell me what is the problem?

Can you set profile to “timings”, run your query, and post the result?

https://docs.couchbase.com/server/current/manage/monitor/monitoring-n1ql-query.html#query-monitoring-settings

 "metrics": {
        "elapsedTime": "7.461507251s",
        "executionTime": "7.461275462s",
        "resultCount": 2871,
        "resultSize": 172260
    },
    "profile": {
        "phaseTimes": {
            "authorize": "2.751461ms",
            "fetch": "2.671758013s",
            "filter": "90.968181ms",
            "indexScan": "4.732661267s",
            "instantiate": "117.112µs",
            "nestedLoopJoin": "398.156511ms",
            "parse": "4.242657ms",
            "plan": "45.178928ms",
            "run": "7.411668435s"
        },
        "phaseCounts": {
            "fetch": 27311,
            "filter": 2871,
            "indexScan": 8175
        },
        "phaseOperators": {
            "authorize": 1,
            "fetch": 2872,
            "filter": 1,
            "indexScan": 2873,
            "nestedLoopJoin": 1
        },
        "executionTimings": {
            "#operator": "Sequence",
            "#stats": {
                "#phaseSwitches": 1,
                "execTime": "3.171µs"
            },
            "~children": [
                {
                    "#operator": "Authorize",
                    "#stats": {
                        "#phaseSwitches": 3,
                        "execTime": "6.63µs",
                        "servTime": "2.744831ms"
                    },
                    "privileges": {
                        "List": [
                            {
                                "Target": "default:cms-data",
                                "Priv": 7
                            },
                            {
                                "Target": "default:cms-deploy-dev",
                                "Priv": 7
                            }
                        ]
                    },
                    "~child": {
                        "#operator": "Sequence",
                        "#stats": {
                            "#phaseSwitches": 1,
                            "execTime": "4.346µs"
                        },
                        "~children": [
                            {
                                "#operator": "IntersectScan",
                                "#stats": {
                                    "#itemsIn": 5303,
                                    "#itemsOut": 2871,
                                    "#phaseSwitches": 16355,
                                    "execTime": "12.50442ms",
                                    "kernTime": "4.765514716s"
                                },
                                "scans": [
                                    {
                                        "#operator": "IndexScan3",
                                        "#stats": {
                                            "#itemsOut": 2871,
                                            "#phaseSwitches": 11489,
                                            "execTime": "8.957573ms",
                                            "kernTime": "5.163049ms",
                                            "servTime": "3.911908ms"
                                        },
                                        "as": "col_data",
                                        "index": "Index_Type_scope",
                                        "index_id": "dea2c57da430025b",
                                        "index_projection": {
                                            "primary_key": true
                                        },
                                        "keyspace": "cms-data",
                                        "namespace": "default",
                                        "spans": [
                                            {
                                                "exact": true,
                                                "range": [
                                                    {
                                                        "high": "\"game\"",
                                                        "inclusion": 3,
                                                        "low": "\"game\""
                                                    },
                                                    {
                                                        "high": "\"rollingslots\"",
                                                        "inclusion": 3,
                                                        "low": "\"rollingslots\""
                                                    }
                                                ]
                                            }
                                        ],
                                        "using": "gsi"
                                    },
                                    {
                                        "#operator": "IndexScan3",
                                        "#stats": {
                                            "#itemsOut": 2432,
                                            "#phaseSwitches": 9735,
                                            "execTime": "9.410368ms",
                                            "kernTime": "4.023204ms",
                                            "servTime": "4.971099ms"
                                        },
                                        "as": "col_data",
                                        "index": "Index_id",
                                        "index_id": "53d698339581e545",
                                        "index_projection": {
                                            "primary_key": true
                                        },
                                        "keyspace": "cms-data",
                                        "namespace": "default",
                                        "spans": [
                                            {
                                                "exact": true,
                                                "range": [
                                                    {
                                                        "inclusion": 0,
                                                        "low": "null"
                                                    }
                                                ]
                                            }
                                        ],
                                        "using": "gsi"
                                    }
                                ]
                            },
                            {
                                "#operator": "Fetch",
                                "#stats": {
                                    "#itemsIn": 2871,
                                    "#itemsOut": 2871,
                                    "#phaseSwitches": 11847,
                                    "execTime": "32.444076ms",
                                    "kernTime": "5.583459862s",
                                    "servTime": "514.495667ms"
                                },
                                "as": "col_data",
                                "keyspace": "cms-data",
                                "namespace": "default"
                            },
                            {
                                "#operator": "Sequence",
                                "#stats": {
                                    "#phaseSwitches": 1,
                                    "execTime": "2.758µs"
                                },
                                "~children": [
                                    {
                                        "#operator": "NestedLoopJoin",
                                        "#stats": {
                                            "#itemsIn": 2871,
                                            "#itemsOut": 2871,
                                            "#phaseSwitches": 28713,
                                            "execTime": "398.156511ms",
                                            "kernTime": "7.010492603s"
                                        },
                                        "alias": "dex",
                                        "on_clause": "((((((`dex`.`id`) = (`col_data`.`id`)) and ((`dex`.`status`) in [\"active\", \"old\"])) and ((`dex`.`hash`) = (`col_data`.`hash`))) and ((`dex`.`_scope`) = \"rollingslots\")) and ((`dex`.`_type`) = \"game\"))",
                                        "~child": {
                                            "#operator": "Sequence",
                                            "#stats": {
                                                "#phaseSwitches": 5742,
                                                "execTime": "493.665169ms",
                                                "kernTime": "3.383161ms",
                                                "state": "running"
                                            },
                                            "~children": [
                                                {
                                                    "#operator": "IndexScan3",
                                                    "#stats": {
                                                        "#itemsOut": 2871,
                                                        "#phaseSwitches": 20097,
                                                        "execTime": "57.832505ms",
                                                        "kernTime": "11.313996ms",
                                                        "servTime": "4.647577814s"
                                                    },
                                                    "as": "dex",
                                                    "index": "Index_status_id_hash",
                                                    "index_id": "42422e314b93442c",
                                                    "index_projection": {
                                                        "primary_key": true
                                                    },
                                                    "keyspace": "cms-deploy-dev",
                                                    "namespace": "default",
                                                    "nested_loop": true,
                                                    "spans": [
                                                        {
                                                            "exact": true,
                                                            "range": [
                                                                {
                                                                    "high": "\"active\"",
                                                                    "inclusion": 3,
                                                                    "low": "\"active\""
                                                                },
                                                                {
                                                                    "high": "(`col_data`.`id`)",
                                                                    "inclusion": 3,
                                                                    "low": "(`col_data`.`id`)"
                                                                },
                                                                {
                                                                    "high": "(`col_data`.`hash`)",
                                                                    "inclusion": 3,
                                                                    "low": "(`col_data`.`hash`)"
                                                                }
                                                            ]
                                                        },
                                                        {
                                                            "exact": true,
                                                            "range": [
                                                                {
                                                                    "high": "\"old\"",
                                                                    "inclusion": 3,
                                                                    "low": "\"old\""
                                                                },
                                                                {
                                                                    "high": "(`col_data`.`id`)",
                                                                    "inclusion": 3,
                                                                    "low": "(`col_data`.`id`)"
                                                                },
                                                                {
                                                                    "high": "(`col_data`.`hash`)",
                                                                    "inclusion": 3,
                                                                    "low": "(`col_data`.`hash`)"
                                                                }
                                                            ]
                                                        }
                                                    ],
                                                    "using": "gsi"
                                                },
                                                {
                                                    "#operator": "Fetch",
                                                    "#stats": {
                                                        "#itemsIn": 2871,
                                                        "#itemsOut": 2871,
                                                        "#phaseSwitches": 25839,
                                                        "execTime": "64.464853ms",
                                                        "kernTime": "4.782144686s",
                                                        "servTime": "2.060353417s"
                                                    },
                                                    "as": "dex",
                                                    "keyspace": "cms-deploy-dev",
                                                    "namespace": "default",
                                                    "nested_loop": true
                                                }
                                            ]
                                        }
                                    },
                                    {
                                        "#operator": "Filter",
                                        "#stats": {
                                            "#itemsIn": 2871,
                                            "#itemsOut": 2871,
                                            "#phaseSwitches": 11487,
                                            "execTime": "90.968181ms",
                                            "kernTime": "7.317758618s"
                                        },
                                        "condition": "(((`col_data`.`_scope`) = \"rollingslots\") and ((`col_data`.`_type`) = \"game\"))"
                                    },
                                    {
                                        "#operator": "InitialProject",
                                        "#stats": {
                                            "#itemsIn": 2871,
                                            "#itemsOut": 2871,
                                            "#phaseSwitches": 8618,
                                            "execTime": "37.9022ms",
                                            "kernTime": "7.340155793s"
                                        },
                                        "result_terms": [
                                            {
                                                "as": "_k",
                                                "expr": "(`dex`.`id`)"
                                            }
                                        ]
                                    },
                                    {
                                        "#operator": "FinalProject",
                                        "#stats": {
                                            "#itemsIn": 2871,
                                            "#itemsOut": 2871,
                                            "#phaseSwitches": 8614,
                                            "execTime": "12.546979ms",
                                            "kernTime": "15.361705ms"
                                        }
                                    }
                                ]
                            }
                        ]
                    }
                },
                {
                    "#operator": "Stream",
                    "#stats": {
                        "#itemsIn": 2871,
                        "#itemsOut": 2871,
                        "#phaseSwitches": 5745,
                        "execTime": "58.629513ms",
                        "kernTime": "7.352970315s"
                    }
                }
            ],
            "~versions": [
                "6.5.0-N1QL",
                "6.6.1-9213-enterprise"
            ]
        }

On top sample join query 8s time

I try query

SELECT count(*)
FROM `cms-data` col_data
    JOIN `cms-deploy-dev` dex ON dex.id = col_data.id
    AND dex.status IN ['active', 'old']
    AND dex.`hash` = col_data.`hash`
    AND dex._scope='rollingslots'
    AND dex._type='game'
WHERE col_data._scope='rollingslots'
    AND col_data._type='game'

Index:
CREATE INDEX adv_id_scope_type_hash ON cms-data(id,hash) WHERE ((_type = ‘game’) and (_scope = ‘rollingslots’))

CREATE INDEX adv_status_id_hash_scope_type ON cms-deploy-dev(status,id,hash) WHERE ((_scope = ‘rollingslots’) and (_type = ‘game’))

In this case execution: 2.4s

Profile is:

  "profile": {
        "phaseTimes": {
            "authorize": "50.787µs",
            "filter": "26.301518ms",
            "indexScan": "2.586600765s",
            "instantiate": "58.798µs",
            "nestedLoopJoin": "86.974602ms",
            "parse": "4.81212ms",
            "plan": "4.690008ms",
            "run": "2.683535553s"
        },
        "phaseCounts": {
            "filter": 2871,
            "indexScan": 5742
        },
        "phaseOperators": {
            "authorize": 1,
            "filter": 1,
            "indexScan": 2872,
            "nestedLoopJoin": 1
        },
        "executionTimings": {
            "#operator": "Sequence",
            "#stats": {
                "#phaseSwitches": 1,
                "execTime": "2.574µs"
            },
            "~children": [
                {
                    "#operator": "Authorize",
                    "#stats": {
                        "#phaseSwitches": 3,
                        "execTime": "2.549µs",
                        "servTime": "48.238µs"
                    },
                    "privileges": {
                        "List": [
                            {
                                "Target": "default:cms-data",
                                "Priv": 7
                            },
                            {
                                "Target": "default:cms-deploy-dev",
                                "Priv": 7
                            }
                        ]
                    },
                    "~child": {
                        "#operator": "Sequence",
                        "#stats": {
                            "#phaseSwitches": 1,
                            "execTime": "1.948µs"
                        },
                        "~children": [
                            {
                                "#operator": "IndexScan3",
                                "#stats": {
                                    "#itemsOut": 2871,
                                    "#phaseSwitches": 11487,
                                    "execTime": "35.396133ms",
                                    "kernTime": "2.197303099s",
                                    "servTime": "7.971621ms"
                                },
                                "as": "col_data",
                                "covers": [
                                    "cover ((`col_data`.`id`))",
                                    "cover ((`col_data`.`hash`))",
                                    "cover ((meta(`col_data`).`id`))"
                                ],
                                "filter_covers": {
                                    "cover ((`col_data`.`_scope`))": "rollingslots",
                                    "cover ((`col_data`.`_type`))": "game"
                                },
                                "index": "adv_id_scope_type_hash",
                                "index_id": "a0ee6fdcaabb1615",
                                "keyspace": "cms-data",
                                "namespace": "default",
                                "spans": [
                                    {
                                        "exact": true,
                                        "range": [
                                            {
                                                "inclusion": 0,
                                                "low": "null"
                                            }
                                        ]
                                    }
                                ],
                                "using": "gsi"
                            },
                            {
                                "#operator": "Sequence",
                                "#stats": {
                                    "#phaseSwitches": 1,
                                    "execTime": "2.34µs"
                                },
                                "~children": [
                                    {
                                        "#operator": "NestedLoopJoin",
                                        "#stats": {
                                            "#itemsIn": 2871,
                                            "#itemsOut": 2871,
                                            "#phaseSwitches": 28713,
                                            "execTime": "86.974602ms",
                                            "kernTime": "2.596257195s"
                                        },
                                        "alias": "dex",
                                        "on_clause": "(((((cover ((`dex`.`id`)) = cover ((`col_data`.`id`))) and (cover ((`dex`.`status`)) in [\"active\", \"old\"])) and (cover ((`dex`.`hash`)) = cover ((`col_data`.`hash`)))) and (cover ((`dex`.`_scope`)) = \"rollingslots\")) and (cover ((`dex`.`_type`)) = \"game\"))",
                                        "~child": {
                                            "#operator": "IndexScan3",
                                            "#stats": {
                                                "#itemsOut": 2871,
                                                "#phaseSwitches": 25839,
                                                "execTime": "121.471404ms",
                                                "kernTime": "22.443593ms",
                                                "servTime": "2.421761607s"
                                            },
                                            "as": "dex",
                                            "covers": [
                                                "cover ((`dex`.`status`))",
                                                "cover ((`dex`.`id`))",
                                                "cover ((`dex`.`hash`))",
                                                "cover ((meta(`dex`).`id`))"
                                            ],
                                            "filter_covers": {
                                                "cover ((`dex`.`_scope`))": "rollingslots",
                                                "cover ((`dex`.`_type`))": "game"
                                            },
                                            "index": "adv_status_id_hash_scope_type",
                                            "index_id": "a1e13fe67065f9ae",
                                            "keyspace": "cms-deploy-dev",
                                            "namespace": "default",
                                            "nested_loop": true,
                                            "spans": [
                                                {
                                                    "exact": true,
                                                    "range": [
                                                        {
                                                            "high": "\"active\"",
                                                            "inclusion": 3,
                                                            "low": "\"active\""
                                                        },
                                                        {
                                                            "high": "cover ((`col_data`.`id`))",
                                                            "inclusion": 3,
                                                            "low": "cover ((`col_data`.`id`))"
                                                        },
                                                        {
                                                            "high": "cover ((`col_data`.`hash`))",
                                                            "inclusion": 3,
                                                            "low": "cover ((`col_data`.`hash`))"
                                                        }
                                                    ]
                                                },
                                                {
                                                    "exact": true,
                                                    "range": [
                                                        {
                                                            "high": "\"old\"",
                                                            "inclusion": 3,
                                                            "low": "\"old\""
                                                        },
                                                        {
                                                            "high": "cover ((`col_data`.`id`))",
                                                            "inclusion": 3,
                                                            "low": "cover ((`col_data`.`id`))"
                                                        },
                                                        {
                                                            "high": "cover ((`col_data`.`hash`))",
                                                            "inclusion": 3,
                                                            "low": "cover ((`col_data`.`hash`))"
                                                        }
                                                    ]
                                                }
                                            ],
                                            "using": "gsi"
                                        }
                                    },
                                    {
                                        "#operator": "Filter",
                                        "#stats": {
                                            "#itemsIn": 2871,
                                            "#itemsOut": 2871,
                                            "#phaseSwitches": 11487,
                                            "execTime": "26.301518ms",
                                            "kernTime": "2.656962225s"
                                        },
                                        "condition": "((cover ((`col_data`.`_scope`)) = \"rollingslots\") and (cover ((`col_data`.`_type`)) = \"game\"))"
                                    },
                                    {
                                        "#operator": "InitialGroup",
                                        "#stats": {
                                            "#itemsIn": 2871,
                                            "#itemsOut": 1,
                                            "#phaseSwitches": 5747,
                                            "execTime": "21.44427ms",
                                            "kernTime": "2.661851217s"
                                        },
                                        "aggregates": [
                                            "count(*)"
                                        ],
                                        "group_keys": []
                                    }
                                ]
                            },
                            {
                                "#operator": "IntermediateGroup",
                                "#stats": {
                                    "#itemsIn": 1,
                                    "#itemsOut": 1,
                                    "#phaseSwitches": 7,
                                    "execTime": "12.603µs",
                                    "kernTime": "2.683304791s"
                                },
                                "aggregates": [
                                    "count(*)"
                                ],
                                "group_keys": []
                            },
                            {
                                "#operator": "FinalGroup",
                                "#stats": {
                                    "#itemsIn": 1,
                                    "#itemsOut": 1,
                                    "#phaseSwitches": 7,
                                    "execTime": "7.728µs",
                                    "kernTime": "2.683337195s"
                                },
                                "aggregates": [
                                    "count(*)"
                                ],
                                "group_keys": []
                            },
                            {
                                "#operator": "Sequence",
                                "#stats": {
                                    "#phaseSwitches": 1,
                                    "execTime": "1.524µs"
                                },
                                "~children": [
                                    {
                                        "#operator": "InitialProject",
                                        "#stats": {
                                            "#itemsIn": 1,
                                            "#itemsOut": 1,
                                            "#phaseSwitches": 8,
                                            "execTime": "30.978µs",
                                            "kernTime": "2.683349747s"
                                        },
                                        "result_terms": [
                                            {
                                                "expr": "count(*)"
                                            }
                                        ]
                                    },
                                    {
                                        "#operator": "FinalProject",
                                        "#stats": {
                                            "#itemsIn": 1,
                                            "#itemsOut": 1,
                                            "#phaseSwitches": 4,
                                            "execTime": "3.772µs",
                                            "kernTime": "10.85µs"
                                        }
                                    }
                                ]
                            }
                        ]
                    }
                },
                {
                    "#operator": "Stream",
                    "#stats": {
                        "#itemsIn": 1,
                        "#itemsOut": 1,
                        "#phaseSwitches": 5,
                        "execTime": "50.64µs",
                        "kernTime": "2.68345818s"
                    }
                }
            ],
            "~versions": [
                "6.5.0-N1QL",
                "6.6.1-9213-enterprise"
            ]
        }
    }

Can you try below query and create necessary index
SELECT count(*) FROM cms-data col_data
JOIN cms-deploy-dev dex ON dex.id = col_data.id AND dex._type=‘game’
WHERE col_data._scope=‘rollingslots’
AND col_data._type=‘game’
AND (dex.status =‘active’ OR dex.status =‘old’)
AND dex.hash = col_data.hash
AND dex._scope=‘rollingslots’

DO NOT differ much (

    "profile": {
        "phaseTimes": {
            "authorize": "70.903µs",
            "filter": "54.334296ms",
            "indexScan": "4.666595841s",
            "instantiate": "140.681µs",
            "nestedLoopJoin": "79.881408ms",
            "parse": "3.923226ms",
            "plan": "10.777735ms",
            "run": "4.757097649s"
        },
        "phaseCounts": {
            "filter": 2871,
            "indexScan": 5742
        },
        "phaseOperators": {
            "authorize": 1,
            "filter": 1,
            "indexScan": 2872,
            "nestedLoopJoin": 1
        },
        "executionTimings": {
            "#operator": "Sequence",
            "#stats": {
                "#phaseSwitches": 1,
                "execTime": "3.507µs"
            },
            "~children": [
                {
                    "#operator": "Authorize",
                    "#stats": {
                        "#phaseSwitches": 3,
                        "execTime": "2.521µs",
                        "servTime": "68.382µs"
                    },
                    "privileges": {
                        "List": [
                            {
                                "Target": "default:cms-data",
                                "Priv": 7
                            },
                            {
                                "Target": "default:cms-deploy-dev",
                                "Priv": 7
                            }
                        ]
                    },
                    "~child": {
                        "#operator": "Sequence",
                        "#stats": {
                            "#phaseSwitches": 1,
                            "execTime": "2.348µs"
                        },
                        "~children": [
                            {
                                "#operator": "IndexScan3",
                                "#stats": {
                                    "#itemsOut": 2871,
                                    "#phaseSwitches": 11487,
                                    "execTime": "37.429488ms",
                                    "kernTime": "3.880133751s",
                                    "servTime": "9.452131ms"
                                },
                                "as": "col_data",
                                "covers": [
                                    "cover ((`col_data`.`_scope`))",
                                    "cover ((`col_data`.`_type`))",
                                    "cover ((`col_data`.`id`))",
                                    "cover ((`col_data`.`hash`))",
                                    "cover ((meta(`col_data`).`id`))"
                                ],
                                "index": "adv_id_scope_type_hash",
                                "index_id": "8ccb31ac67e56c22",
                                "keyspace": "cms-data",
                                "namespace": "default",
                                "spans": [
                                    {
                                        "exact": true,
                                        "range": [
                                            {
                                                "high": "\"rollingslots\"",
                                                "inclusion": 3,
                                                "low": "\"rollingslots\""
                                            },
                                            {
                                                "high": "\"game\"",
                                                "inclusion": 3,
                                                "low": "\"game\""
                                            },
                                            {
                                                "inclusion": 0,
                                                "low": "null"
                                            }
                                        ]
                                    }
                                ],
                                "using": "gsi"
                            },
                            {
                                "#operator": "Sequence",
                                "#stats": {
                                    "#phaseSwitches": 1,
                                    "execTime": "2.411µs"
                                },
                                "~children": [
                                    {
                                        "#operator": "NestedLoopJoin",
                                        "#stats": {
                                            "#itemsIn": 2871,
                                            "#itemsOut": 2871,
                                            "#phaseSwitches": 28713,
                                            "execTime": "79.881408ms",
                                            "kernTime": "4.676692933s"
                                        },
                                        "alias": "dex",
                                        "on_clause": "((cover ((`dex`.`id`)) = cover ((`col_data`.`id`))) and (cover ((`dex`.`_type`)) = \"game\"))",
                                        "~child": {
                                            "#operator": "IndexScan3",
                                            "#stats": {
                                                "#itemsOut": 2871,
                                                "#phaseSwitches": 25839,
                                                "execTime": "134.410395ms",
                                                "kernTime": "25.30732ms",
                                                "servTime": "4.485303827s"
                                            },
                                            "as": "dex",
                                            "covers": [
                                                "cover ((`dex`.`status`))",
                                                "cover ((`dex`.`hash`))",
                                                "cover ((`dex`.`id`))",
                                                "cover ((meta(`dex`).`id`))"
                                            ],
                                            "filter_covers": {
                                                "cover ((`dex`.`_scope`))": "rollingslots",
                                                "cover ((`dex`.`_type`))": "game"
                                            },
                                            "index": "adv_status_hash_id_type_scope",
                                            "index_id": "80e8309e84cc1e62",
                                            "keyspace": "cms-deploy-dev",
                                            "namespace": "default",
                                            "nested_loop": true,
                                            "spans": [
                                                {
                                                    "exact": true,
                                                    "range": [
                                                        {
                                                            "high": "\"active\"",
                                                            "inclusion": 3,
                                                            "low": "\"active\""
                                                        },
                                                        {
                                                            "high": "cover ((`col_data`.`hash`))",
                                                            "inclusion": 3,
                                                            "low": "cover ((`col_data`.`hash`))"
                                                        },
                                                        {
                                                            "high": "cover ((`col_data`.`id`))",
                                                            "inclusion": 3,
                                                            "low": "cover ((`col_data`.`id`))"
                                                        }
                                                    ]
                                                },
                                                {
                                                    "exact": true,
                                                    "range": [
                                                        {
                                                            "high": "\"old\"",
                                                            "inclusion": 3,
                                                            "low": "\"old\""
                                                        },
                                                        {
                                                            "high": "cover ((`col_data`.`hash`))",
                                                            "inclusion": 3,
                                                            "low": "cover ((`col_data`.`hash`))"
                                                        },
                                                        {
                                                            "high": "cover ((`col_data`.`id`))",
                                                            "inclusion": 3,
                                                            "low": "cover ((`col_data`.`id`))"
                                                        }
                                                    ]
                                                }
                                            ],
                                            "using": "gsi"
                                        }
                                    },
                                    {
                                        "#operator": "Filter",
                                        "#stats": {
                                            "#itemsIn": 2871,
                                            "#itemsOut": 2871,
                                            "#phaseSwitches": 11487,
                                            "execTime": "54.334296ms",
                                            "kernTime": "4.702405602s"
                                        },
                                        "condition": "(((((cover ((`col_data`.`_scope`)) = \"rollingslots\") and (cover ((`col_data`.`_type`)) = \"game\")) and ((cover ((`dex`.`status`)) = \"active\") or (cover ((`dex`.`status`)) = \"old\"))) and (cover ((`dex`.`hash`)) = cover ((`col_data`.`hash`)))) and (cover ((`dex`.`_scope`)) = \"rollingslots\"))"
                                    },
                                    {
                                        "#operator": "InitialGroup",
                                        "#stats": {
                                            "#itemsIn": 2871,
                                            "#itemsOut": 1,
                                            "#phaseSwitches": 5747,
                                            "execTime": "20.704708ms",
                                            "kernTime": "4.736070945s"
                                        },
                                        "aggregates": [
                                            "count(*)"
                                        ],
                                        "group_keys": []
                                    }
                                ]
                            },
                            {
                                "#operator": "IntermediateGroup",
                                "#stats": {
                                    "#itemsIn": 1,
                                    "#itemsOut": 1,
                                    "#phaseSwitches": 7,
                                    "execTime": "14.461µs",
                                    "kernTime": "4.75678764s"
                                },
                                "aggregates": [
                                    "count(*)"
                                ],
                                "group_keys": []
                            },
                            {
                                "#operator": "FinalGroup",
                                "#stats": {
                                    "#itemsIn": 1,
                                    "#itemsOut": 1,
                                    "#phaseSwitches": 7,
                                    "execTime": "10.798µs",
                                    "kernTime": "4.756810839s"
                                },
                                "aggregates": [
                                    "count(*)"
                                ],
                                "group_keys": []
                            },
                            {
                                "#operator": "Sequence",
                                "#stats": {
                                    "#phaseSwitches": 1,
                                    "execTime": "1.672µs"
                                },
                                "~children": [
                                    {
                                        "#operator": "InitialProject",
                                        "#stats": {
                                            "#itemsIn": 1,
                                            "#itemsOut": 1,
                                            "#phaseSwitches": 8,
                                            "execTime": "61.161µs",
                                            "kernTime": "4.756828032s"
                                        },
                                        "result_terms": [
                                            {
                                                "expr": "count(*)"
                                            }
                                        ]
                                    },
                                    {
                                        "#operator": "FinalProject",
                                        "#stats": {
                                            "#itemsIn": 1,
                                            "#itemsOut": 1,
                                            "#phaseSwitches": 4,
                                            "execTime": "6.107µs",
                                            "kernTime": "16.77µs"
                                        }
                                    }
                                ]
                            }
                        ]
                    }
                },
                {
                    "#operator": "Stream",
                    "#stats": {
                        "#itemsIn": 1,
                        "#itemsOut": 1,
                        "#phaseSwitches": 5,
                        "execTime": "47.565µs",
                        "kernTime": "4.756998435s"
                    }
                }
            ],
            "~versions": [
                "6.5.0-N1QL",
                "6.6.1-9213-enterprise"
            ]
        }
    }

Plan uses Nested Loop Outer Scan produces 2871, then it needs to that many indexScans on inner

As you are using 6.6.1-9213-enterprise try with HASH JOIN Example 9 ANSI JOIN Support in N1QL | The Couchbase Blog

From the profiles posted it appears that execTime is low and kernTime is high, this indicates that either the query node is under heavy load, or the client is not consuming the query result fast enough so the operators are “backed up”. With the count(*) query above showing similar behavior this seems to indicate the former.

Thank you! HASH JOIN is really faster