@vsr1 I am not quite pro in it
Used explain for
SELECT COUNT(1)
FROM ( WITH consumerIds AS (SELECT RAW META(cmrs).id
                            FROM production AS cmrs
                            WHERE cmrs._class = "model.Consumer"
                                  AND cmrs.code = "C1"
                                  AND cmrs.forename IS VALUED
                                  AND IFMISSINGORNULL(cmrs.marketingPreferences.email,FALSE) = FALSE
                                  AND IFMISSINGORNULL(cmrs.marketingPreferences.post,FALSE) = FALSE
                                  AND IFMISSINGORNULL(cmrs.marketingPreferences.sms,FALSE) = FALSE
                                  AND IFMISSINGORNULL(cmrs.marketingPreferences.social,FALSE) = FALSE
                                  AND IFMISSINGORNULL(cmrs.marketingPreferences.telephone,FALSE) = FALSE)
       SELECT trs.transactionTotal, trs.consumerId IN consumerIds AS flag
       FROM production trs
       WHERE trs._class = "model.Transaction"
             AND trs.originalSource = "S1"
             AND trs.code = "C1"
             AND trs.timestamp BETWEEN "2021-02-02T23:00:00Z" AND "2022-02-03T22:59:59Z"
             AND LOWER(trs.status) != "deleted"
             AND trs.currency = "GBP") AS st
WHERE st.flag = TRUE
{
    "#operator": "Sequence",
    "~children": [
        {
            "#operator": "With",
            "bindings": [
                {
                    "expr": "(select raw (meta(`cmrs`).`id`) from `production` as `cmrs` where (((((((((`cmrs`.`_class`) = \"model.Consumer\") and ((`cmrs`.`code`) = \"C1\")) and ((`cmrs`.`forename`) is valued)) and (ifmissingornull(((`cmrs`.`marketingPreferences`).`email`), false) = false)) and (ifmissingornull(((`cmrs`.`marketingPreferences`).`post`), false) = false)) and (ifmissingornull(((`cmrs`.`marketingPreferences`).`sms`), false) = false)) and (ifmissingornull(((`cmrs`.`marketingPreferences`).`social`), false) = false)) and (ifmissingornull(((`cmrs`.`marketingPreferences`).`telephone`), false) = false)))",
                    "static": true,
                    "var": "consumerIds"
                }
            ],
            "~child": {
                "#operator": "Sequence",
                "~children": [
                    {
                        "#operator": "UnionScan",
                        "scans": [
                            {
                                "#operator": "IntersectScan",
                                "scans": [
                                    {
                                        "#operator": "IndexScan3",
                                        "as": "trs",
                                        "index": "prod_adv_originalSource_timestamp_lower_status_code_class",
                                        "index_id": "43c5d0524bc07061",
                                        "index_projection": {
                                            "primary_key": true
                                        },
                                        "keyspace": "production",
                                        "namespace": "default",
                                        "spans": [
                                            {
                                                "exact": true,
                                                "range": [
                                                    {
                                                        "high": "\"deleted\"",
                                                        "inclusion": 0,
                                                        "low": "null"
                                                    },
                                                    {
                                                        "high": "\"C1\"",
                                                        "inclusion": 3,
                                                        "low": "\"C1\""
                                                    },
                                                    {
                                                        "high": "\"2022-02-03T22:59:59Z\"",
                                                        "inclusion": 3,
                                                        "low": "\"2021-02-02T23:00:00Z\""
                                                    }
                                                ]
                                            }
                                        ],
                                        "using": "gsi"
                                    },
                                    {
                                        "#operator": "IndexScan3",
                                        "as": "trs",
                                        "index": "prod_adv_originalSource_currency_timestamp_lower_status_to_number_transactionTotal_class_code_C1_V2",
                                        "index_id": "a63ad08fa500a310",
                                        "index_projection": {
                                            "primary_key": true
                                        },
                                        "keyspace": "production",
                                        "namespace": "default",
                                        "spans": [
                                            {
                                                "exact": true,
                                                "range": [
                                                    {
                                                        "high": "\"2022-02-03T22:59:59Z\"",
                                                        "inclusion": 3,
                                                        "low": "\"2021-02-02T23:00:00Z\""
                                                    }
                                                ]
                                            }
                                        ],
                                        "using": "gsi"
                                    },
                                    {
                                        "#operator": "IndexScan3",
                                        "as": "trs",
                                        "index": "prod_adv_originalSource_currency_timestamp_lower_status_to_number_transactionTotal_class_code_C1",
                                        "index_id": "745b2cfca33bce19",
                                        "index_projection": {
                                            "primary_key": true
                                        },
                                        "keyspace": "production",
                                        "namespace": "default",
                                        "spans": [
                                            {
                                                "exact": true,
                                                "range": [
                                                    {
                                                        "high": "\"S1\"",
                                                        "inclusion": 3,
                                                        "low": "\"S1\""
                                                    },
                                                    {
                                                        "high": "\"GBP\"",
                                                        "inclusion": 3,
                                                        "low": "\"GBP\""
                                                    },
                                                    {
                                                        "high": "\"2022-02-03T22:59:59Z\"",
                                                        "inclusion": 3,
                                                        "low": "\"2021-02-02T23:00:00Z\""
                                                    },
                                                    {
                                                        "high": "\"deleted\"",
                                                        "inclusion": 0,
                                                        "low": "null"
                                                    }
                                                ]
                                            }
                                        ],
                                        "using": "gsi"
                                    },
                                    {
                                        "#operator": "IndexScan3",
                                        "as": "trs",
                                        "index": "prod_adv_currency_originalSource_timestamp_lower_status_transaction",
                                        "index_id": "1240c741f21f2520",
                                        "index_projection": {
                                            "primary_key": true
                                        },
                                        "keyspace": "production",
                                        "namespace": "default",
                                        "spans": [
                                            {
                                                "exact": true,
                                                "range": [
                                                    {
                                                        "high": "\"deleted\"",
                                                        "inclusion": 0,
                                                        "low": "null"
                                                    },
                                                    {
                                                        "high": "\"GBP\"",
                                                        "inclusion": 3,
                                                        "low": "\"GBP\""
                                                    },
                                                    {
                                                        "high": "\"2022-02-03T22:59:59Z\"",
                                                        "inclusion": 3,
                                                        "low": "\"2021-02-02T23:00:00Z\""
                                                    },
                                                    {
                                                        "inclusion": 0
                                                    },
                                                    {
                                                        "high": "\"C1\"",
                                                        "inclusion": 3,
                                                        "low": "\"C1\""
                                                    }
                                                ]
                                            }
                                        ],
                                        "using": "gsi"
                                    }
                                ]
                            },
                            {
                                "#operator": "IntersectScan",
                                "scans": [
                                    {
                                        "#operator": "IndexScan3",
                                        "as": "trs",
                                        "index": "prod_adv_originalSource_timestamp_lower_status_code_class",
                                        "index_id": "43c5d0524bc07061",
                                        "index_projection": {
                                            "primary_key": true
                                        },
                                        "keyspace": "production",
                                        "namespace": "default",
                                        "spans": [
                                            {
                                                "exact": true,
                                                "range": [
                                                    {
                                                        "inclusion": 0,
                                                        "low": "\"deleted\""
                                                    },
                                                    {
                                                        "high": "\"C1\"",
                                                        "inclusion": 3,
                                                        "low": "\"C1\""
                                                    },
                                                    {
                                                        "high": "\"2022-02-03T22:59:59Z\"",
                                                        "inclusion": 3,
                                                        "low": "\"2021-02-02T23:00:00Z\""
                                                    }
                                                ]
                                            }
                                        ],
                                        "using": "gsi"
                                    },
                                    {
                                        "#operator": "IndexScan3",
                                        "as": "trs",
                                        "index": "prod_adv_currency_originalSource_timestamp_lower_status_transaction",
                                        "index_id": "1240c741f21f2520",
                                        "index_projection": {
                                            "primary_key": true
                                        },
                                        "keyspace": "production",
                                        "namespace": "default",
                                        "spans": [
                                            {
                                                "exact": true,
                                                "range": [
                                                    {
                                                        "inclusion": 0,
                                                        "low": "\"deleted\""
                                                    },
                                                    {
                                                        "high": "\"GBP\"",
                                                        "inclusion": 3,
                                                        "low": "\"GBP\""
                                                    },
                                                    {
                                                        "high": "\"2022-02-03T22:59:59Z\"",
                                                        "inclusion": 3,
                                                        "low": "\"2021-02-02T23:00:00Z\""
                                                    },
                                                    {
                                                        "inclusion": 0
                                                    },
                                                    {
                                                        "high": "\"C1\"",
                                                        "inclusion": 3,
                                                        "low": "\"C1\""
                                                    }
                                                ]
                                            }
                                        ],
                                        "using": "gsi"
                                    },
                                    {
                                        "#operator": "IndexScan3",
                                        "as": "trs",
                                        "index": "prod_adv_originalSource_currency_timestamp_lower_status_to_number_transactionTotal_class_code_C1_V2",
                                        "index_id": "a63ad08fa500a310",
                                        "index_projection": {
                                            "primary_key": true
                                        },
                                        "keyspace": "production",
                                        "namespace": "default",
                                        "spans": [
                                            {
                                                "exact": true,
                                                "range": [
                                                    {
                                                        "high": "\"2022-02-03T22:59:59Z\"",
                                                        "inclusion": 3,
                                                        "low": "\"2021-02-02T23:00:00Z\""
                                                    }
                                                ]
                                            }
                                        ],
                                        "using": "gsi"
                                    },
                                    {
                                        "#operator": "IndexScan3",
                                        "as": "trs",
                                        "index": "prod_adv_originalSource_currency_timestamp_lower_status_to_number_transactionTotal_class_code_C1",
                                        "index_id": "745b2cfca33bce19",
                                        "index_projection": {
                                            "primary_key": true
                                        },
                                        "keyspace": "production",
                                        "namespace": "default",
                                        "spans": [
                                            {
                                                "exact": true,
                                                "range": [
                                                    {
                                                        "high": "\"S1\"",
                                                        "inclusion": 3,
                                                        "low": "\"S1\""
                                                    },
                                                    {
                                                        "high": "\"GBP\"",
                                                        "inclusion": 3,
                                                        "low": "\"GBP\""
                                                    },
                                                    {
                                                        "high": "\"2022-02-03T22:59:59Z\"",
                                                        "inclusion": 3,
                                                        "low": "\"2021-02-02T23:00:00Z\""
                                                    },
                                                    {
                                                        "inclusion": 0,
                                                        "low": "\"deleted\""
                                                    }
                                                ]
                                            }
                                        ],
                                        "using": "gsi"
                                    }
                                ]
                            }
                        ]
                    },
                    {
                        "#operator": "Fetch",
                        "as": "trs",
                        "keyspace": "production",
                        "namespace": "default"
                    },
                    {
                        "#operator": "Parallel",
                        "~child": {
                            "#operator": "Sequence",
                            "~children": [
                                {
                                    "#operator": "Filter",
                                    "condition": "(((((((`trs`.`_class`) = \"model.Transaction\") and ((`trs`.`originalSource`) = \"S1\")) and ((`trs`.`code`) = \"C1\")) and ((`trs`.`timestamp`) between \"2021-02-02T23:00:00Z\" and \"2022-02-03T22:59:59Z\")) and (not (lower((`trs`.`status`)) = \"deleted\"))) and ((`trs`.`currency`) = \"GBP\"))"
                                },
                                {
                                    "#operator": "InitialProject",
                                    "result_terms": [
                                        {
                                            "expr": "(`trs`.`transactionTotal`)"
                                        },
                                        {
                                            "as": "flag",
                                            "expr": "((`trs`.`consumerId`) in `consumerIds`)"
                                        }
                                    ]
                                },
                                {
                                    "#operator": "FinalProject"
                                }
                            ]
                        }
                    }
                ]
            }
        },
        {
            "#operator": "Alias",
            "as": "st"
        },
        {
            "#operator": "Parallel",
            "~child": {
                "#operator": "Sequence",
                "~children": [
                    {
                        "#operator": "Filter",
                        "condition": "((`st`.`flag`) = true)"
                    },
                    {
                        "#operator": "InitialGroup",
                        "aggregates": [
                            "count(1)"
                        ],
                        "group_keys": []
                    }
                ]
            }
        },
        {
            "#operator": "IntermediateGroup",
            "aggregates": [
                "count(1)"
            ],
            "group_keys": []
        },
        {
            "#operator": "FinalGroup",
            "aggregates": [
                "count(1)"
            ],
            "group_keys": []
        },
        {
            "#operator": "Parallel",
            "~child": {
                "#operator": "Sequence",
                "~children": [
                    {
                        "#operator": "InitialProject",
                        "result_terms": [
                            {
                                "expr": "count(1)"
                            }
                        ]
                    },
                    {
                        "#operator": "FinalProject"
                    }
                ]
            }
        }
    ]
}