I also tried to remove the order by to understand what is the problem.
It still slow the same result time.
The explain:
{
“plan”: {
"#operator": “Sequence”,
"~children": [
{
"#operator": “DistinctScan”,
“scan”: {
"#operator": “IndexScan2”,
“index”: “ix22”,
“index_id”: “404e08b98a21a99e”,
“index_projection”: {
“primary_key”: true
},
“keyspace”: “test”,
“namespace”: “default”,
“spans”: [
{
“exact”: true,
“range”: [
{
“high”: “1”,
“inclusion”: 3,
“low”: “1”
}
]
},
{
“exact”: true,
“range”: [
{
“high”: “2”,
“inclusion”: 3,
“low”: “2”
}
]
}
],
“using”: “gsi”
}
},
{
"#operator": “Fetch”,
“keyspace”: “test”,
“namespace”: “default”
},
{
"#operator": “Parallel”,
"~child": {
"#operator": “Sequence”,
"~children": [
{
"#operator": “Filter”,
“condition”: “(((test
.tbl
) = “msgs”) and any and every userId
in (test
.usersInChat
) satisfies (userId
in [1, 2]) end)”
},
{
"#operator": “InitialProject”,
“result_terms”: [
{
“expr”: “(test
.idCampaign
)”
},
{
“expr”: “(test
.isRead
)”
},
{
“expr”: “(test
.msg
)”
},
{
“expr”: “(test
.server_date
)”
},
{
“expr”: “(test
.toUser
)”
},
{
“expr”: “(test
.type
)”
},
{
“expr”: “(test
.user_date
)”
},
{
“expr”: “(test
.usersInChat
)”
}
]
},
{
"#operator": “FinalProject”
}
]
}
}
]
},
“text”: “select idCampaign , isRead , msg , server_date , toUser , type , user_date , usersInChat from test where tbl=“msgs” And Any And Every userId in usersInChat satisfies userId in [1,2] end”
}