Hi @dh
please find below the profiling results.
{
"#operator": "Authorize",
"#stats": {
"#phaseSwitches": 4,
"execTime": "1.399”s",
"servTime": "14.297”s"
},
"privileges": {
"List": [
{
"Target": "default:api_external",
"Priv": 7,
"Props": 0
}
]
},
"~child": {
"#operator": "Sequence",
"#stats": {
"#phaseSwitches": 2,
"execTime": "2.93”s"
},
"~children": [
{
"#operator": "IndexScan3",
"#stats": {
"#heartbeatYields": 1,
"#itemsOut": 3026,
"#phaseSwitches": 12107,
"execTime": "56.532396ms",
"kernTime": "3.61118285s",
"servTime": "10.036212ms"
},
"as": "p",
"covers": [
"cover ((`p`.`type`))",
"cover (((`p`.`data`).`companyId`))",
"cover ((`p`.`uuid`))",
"cover (((`p`.`data`).`appName`))",
"cover (((`p`.`data`).`description`))",
"cover (((`p`.`data`).`fourthParty`))",
"cover ((`p`.`deleted`))",
"cover (((`p`.`data`).`additionalAdmins`))",
"cover (((`p`.`data`).`additionalDevelopers`))",
"cover ((`p`.`backupOf`))",
"cover ((meta(`p`).`id`))"
],
"filter": "((cover ((`p`.`type`)) = \"partnerApp\") and (cover ((`p`.`deleted`)) = false) and (not (cover (((`p`.`data`).`companyId`)) in [\"testCompanyid1\", \"testCompanyid2\"])) and ((cover (((`p`.`data`).`companyId`)) < \"testCompanyid2\") or (\"testCompanyid2\" < cover (((`p`.`data`).`companyId`)))) and (cover ((`p`.`backupOf`)) is null))",
"filter_covers": {
"cover ((`p`.`type`))": "partnerApp"
},
"index": "apiExt_prtrApp_type",
"index_id": "771601742488e452",
"index_projection": {
"entry_keys": [
0,
1,
2,
6,
9
]
},
"keyspace": "api_external",
"namespace": "default",
"spans": [
{
"exact": true,
"range": [
{
"high": "\"partnerApp\"",
"inclusion": 3,
"index_key": "`type`",
"low": "\"partnerApp\""
},
{
"high": "\"testCompanyid1\"",
"inclusion": 0,
"index_key": "(`data`.`companyId`)",
"low": "null"
},
{
"inclusion": 0,
"index_key": "`uuid`"
},
{
"inclusion": 0,
"index_key": "(`data`.`appName`)"
},
{
"inclusion": 0,
"index_key": "(`data`.`description`)"
},
{
"inclusion": 0,
"index_key": "(`data`.`fourthParty`)"
},
{
"high": "false",
"inclusion": 3,
"index_key": "`deleted`",
"low": "false"
},
{
"inclusion": 0,
"index_key": "(`data`.`additionalAdmins`)"
},
{
"inclusion": 0,
"index_key": "(`data`.`additionalDevelopers`)"
},
{
"high": "null",
"inclusion": 3,
"index_key": "`backupOf`",
"low": "null"
}
]
},
{
"exact": true,
"range": [
{
"high": "\"partnerApp\"",
"inclusion": 3,
"index_key": "`type`",
"low": "\"partnerApp\""
},
{
"high": "\"testCompanyid2\"",
"inclusion": 0,
"index_key": "(`data`.`companyId`)",
"low": "\"testCompanyid1\""
},
{
"inclusion": 0,
"index_key": "`uuid`"
},
{
"inclusion": 0,
"index_key": "(`data`.`appName`)"
},
{
"inclusion": 0,
"index_key": "(`data`.`description`)"
},
{
"inclusion": 0,
"index_key": "(`data`.`fourthParty`)"
},
{
"high": "false",
"inclusion": 3,
"index_key": "`deleted`",
"low": "false"
},
{
"inclusion": 0,
"index_key": "(`data`.`additionalAdmins`)"
},
{
"inclusion": 0,
"index_key": "(`data`.`additionalDevelopers`)"
},
{
"high": "null",
"inclusion": 3,
"index_key": "`backupOf`",
"low": "null"
}
]
},
{
"exact": true,
"range": [
{
"high": "\"partnerApp\"",
"inclusion": 3,
"index_key": "`type`",
"low": "\"partnerApp\""
},
{
"inclusion": 0,
"index_key": "(`data`.`companyId`)",
"low": "\"testCompanyid2\""
},
{
"inclusion": 0,
"index_key": "`uuid`"
},
{
"inclusion": 0,
"index_key": "(`data`.`appName`)"
},
{
"inclusion": 0,
"index_key": "(`data`.`description`)"
},
{
"inclusion": 0,
"index_key": "(`data`.`fourthParty`)"
},
{
"high": "false",
"inclusion": 3,
"index_key": "`deleted`",
"low": "false"
},
{
"inclusion": 0,
"index_key": "(`data`.`additionalAdmins`)"
},
{
"inclusion": 0,
"index_key": "(`data`.`additionalDevelopers`)"
},
{
"high": "null",
"inclusion": 3,
"index_key": "`backupOf`",
"low": "null"
}
]
}
],
"using": "gsi",
"#time_normal": "00:00.066",
"#time_absolute": 0.066568608
},
{
"#operator": "Sequence",
"#stats": {
"#phaseSwitches": 1,
"execTime": "1.543”s"
},
"~children": [
{
"#operator": "NestedLoopJoin",
"#stats": {
"#itemsIn": 3026,
"#itemsOut": 2443,
"#phaseSwitches": 27932,
"execTime": "51.492505ms",
"kernTime": "4.423013795s"
},
"alias": "i",
"on_clause": "(cover ((`p`.`uuid`)) = cover (((`i`.`data`).`partnerAppId`)))",
"~child": {
"#operator": "IndexScan3",
"#stats": {
"#itemsOut": 2443,
"#phaseSwitches": 24902,
"execTime": "90.663302ms",
"kernTime": "12.178049ms",
"servTime": "4.279160339s"
},
"as": "i",
"covers": [
"cover ((`i`.`type`))",
"cover (((`i`.`data`).`partnerAppId`))",
"cover (((`i`.`data`).`env`))",
"cover (((`i`.`data`).`productStatus`))",
"cover ((`i`.`updatedTs`))",
"cover ((`i`.`createdTs`))",
"cover (((`i`.`data`).`productId`))",
"cover (((`i`.`data`).`status`))",
"cover ((`i`.`deleted`))",
"cover ((`i`.`backupOf`))",
"cover ((meta(`i`).`id`))"
],
"filter": "((cover ((`i`.`type`)) = \"integration\") and (cover (((`i`.`data`).`env`)) = \"SANDBOX\") and (cover ((`i`.`deleted`)) = false) and (cover ((`i`.`backupOf`)) is null))",
"filter_covers": {
"cover ((`i`.`type`))": "integration"
},
"index": "apiExt_intg_type",
"index_id": "6c452582111482e8",
"index_projection": {
"entry_keys": [
0,
1,
2,
3,
6,
7,
8,
9
]
},
"keyspace": "api_external",
"namespace": "default",
"nested_loop": true,
"spans": [
{
"exact": true,
"range": [
{
"high": "\"integration\"",
"inclusion": 3,
"index_key": "`type`",
"low": "\"integration\""
},
{
"high": "cover ((`p`.`uuid`))",
"inclusion": 3,
"index_key": "(`data`.`partnerAppId`)",
"low": "cover ((`p`.`uuid`))"
},
{
"high": "\"SANDBOX\"",
"inclusion": 3,
"index_key": "(`data`.`env`)",
"low": "\"SANDBOX\""
},
{
"inclusion": 0,
"index_key": "(`data`.`productStatus`)"
},
{
"inclusion": 0,
"index_key": "`updatedTs`"
},
{
"inclusion": 0,
"index_key": "`createdTs`"
},
{
"inclusion": 0,
"index_key": "(`data`.`productId`)"
},
{
"inclusion": 0,
"index_key": "(`data`.`status`)"
},
{
"high": "false",
"inclusion": 3,
"index_key": "`deleted`",
"low": "false"
},
{
"high": "null",
"inclusion": 3,
"index_key": "`backupOf`",
"low": "null"
}
]
}
],
"using": "gsi",
"#time_normal": "00:04.369",
"#time_absolute": 4.369823641
},
"#time_normal": "00:00.051",
"#time_absolute": 0.051492505
},
{
"#operator": "Unnest",
"#stats": {
"#itemsIn": 2443,
"#itemsOut": 3496,
"#phaseSwitches": 11882,
"execTime": "42.523221ms",
"kernTime": "4.432003037s"
},
"as": "ps",
"expr": "object_pairs(cover (((`i`.`data`).`productStatus`)))",
"outer": true,
"#time_normal": "00:00.042",
"#time_absolute": 0.042523221
}
],
"#time_normal": "00:00.000",
"#time_absolute": 0.0000015429999999999999
},
{
"#operator": "Sequence",
"#stats": {
"#phaseSwitches": 1,
"execTime": "2.03”s"
},
"~children": [
{
"#operator": "Let",
"#stats": {
"#itemsIn": 3496,
"#itemsOut": 3496,
"#phaseSwitches": 13988,
"execTime": "20.014698ms",
"kernTime": "4.454534597s"
},
"bindings": [
{
"expr": "ifmissingornull(cover (((`i`.`data`).`productId`)), (`ps`.`name`))",
"var": "product"
},
{
"expr": "ifmissingornull(cover (((`i`.`data`).`status`)), (`ps`.`val`))",
"var": "status"
}
],
"#time_normal": "00:00.020",
"#time_absolute": 0.020014698
},
{
"#operator": "Filter",
"#stats": {
"#itemsIn": 3496,
"#itemsOut": 566,
"#phaseSwitches": 8128,
"execTime": "14.897275ms",
"kernTime": "4.459677788s"
},
"condition": "((`status` = \"APPROVED\") and (`product` in [\"30040f71c95a474d8ec7e3804c5358dc\"]))",
"#time_normal": "00:00.014",
"#time_absolute": 0.014897275
},
{
"#operator": "InitialGroup",
"#stats": {
"#itemsIn": 566,
"#itemsOut": 1,
"#phaseSwitches": 1138,
"execTime": "13.844479ms",
"kernTime": "4.46075606s"
},
"aggregates": [
"count(DISTINCT cover (((`p`.`data`).`companyId`)))"
],
"group_keys": [
"`product`"
],
"#time_normal": "00:00.013",
"#time_absolute": 0.013844479
}
],
"#time_normal": "00:00.000",
"#time_absolute": 0.0000020299999999999996
},
{
"#operator": "IntermediateGroup",
"#stats": {
"#itemsIn": 1,
"#itemsOut": 1,
"#phaseSwitches": 8,
"execTime": "27.481”s",
"kernTime": "4.474623759s"
},
"aggregates": [
"count(DISTINCT cover (((`p`.`data`).`companyId`)))"
],
"group_keys": [
"`product`"
],
"#time_normal": "00:00.000",
"#time_absolute": 0.000027481
},
{
"#operator": "FinalGroup",
"#stats": {
"#itemsIn": 1,
"#itemsOut": 1,
"#phaseSwitches": 8,
"execTime": "24.008”s",
"kernTime": "4.474671944s"
},
"aggregates": [
"count(DISTINCT cover (((`p`.`data`).`companyId`)))"
],
"group_keys": [
"`product`"
],
"#time_normal": "00:00.000",
"#time_absolute": 0.000024007999999999998
},
{
"#operator": "InitialProject",
"#stats": {
"#itemsIn": 1,
"#itemsOut": 1,
"#phaseSwitches": 8,
"execTime": "1.439592ms",
"kernTime": "4.474705431s",
"state": "running"
},
"discard_original": true,
"result_terms": [
{
"expr": "`product`"
},
{
"as": "totalRequestedCount",
"expr": "count(DISTINCT cover (((`p`.`data`).`companyId`)))"
}
],
"#time_normal": "00:00.001",
"#time_absolute": 0.001439592
},
{
"#operator": "Stream",
"#stats": {
"#itemsIn": 1,
"#itemsOut": 1,
"#phaseSwitches": 2,
"execTime": "20.477”s"
},
"#time_normal": "00:00.000",
"#time_absolute": 0.000020477
}
],
"#time_normal": "00:00.000",
"#time_absolute": 0.0000029300000000000003
},
"~versions": [
"7.2.2-N1QL",
"7.2.2-6401-enterprise"
],
"#time_normal": "00:00.000",
"#time_absolute": 0.000015696
}