How can I find out which query is causing it? We are running many queries.
Let me try my best…
- This is one of the queries that takes longer than other queries.
select * from mybucket bucket1 where bucket1.clientId = 'aValue' and bucket1.form = 'aValue' and bucket1.`values`.`slug` = 'aValue'
Explain of the query:
{
"requestID": "02ac34a7-6dfb-4b31-b8a8-18b5dbc597c5",
"signature": "json",
"results": [
{
"#operator": "Sequence",
"~children": [
{
"#operator": "IntersectScan",
"scans": [
{
"#operator": "IndexScan",
"index": "idx_product_type_clientId",
"keyspace": "catalog",
"namespace": "default",
"spans": [
{
"Range": {
"High": [
"\"aValue\""
],
"Inclusion": 3,
"Low": [
"\"aValue\""
]
}
}
],
"using": "gsi"
},
{
"#operator": "IndexScan",
"index": "idx_product_type_slug",
"keyspace": "catalog",
"namespace": "default",
"spans": [
{
"Range": {
"High": [
"\"aValue\""
],
"Inclusion": 3,
"Low": [
"\"aValue\""
]
}
}
],
"using": "gsi"
},
{
"#operator": "IndexScan",
"index": "idx_product_type_form",
"keyspace": "catalog",
"namespace": "default",
"spans": [
{
"Range": {
"High": [
"\"aValue\""
],
"Inclusion": 3,
"Low": [
"\"aValue\""
]
}
}
],
"using": "gsi"
}
]
},
{
"#operator": "Parallel",
"~child": {
"#operator": "Sequence",
"~children": [
{
"#operator": "Fetch",
"as": "bucket1",
"keyspace": "catalog",
"namespace": "default"
},
{
"#operator": "Filter",
"condition": "((((`bucket1`.`clientId`) = \"aValue\") and ((`bucket1`.`form`) = \"aValue\")) and (((`bucket1`.`values`).`slug`) = \"avalue\"))"
},
{
"#operator": "InitialProject",
"result_terms": [
{
"expr": "self",
"star": true
}
]
},
{
"#operator": "FinalProject"
}
]
}
}
]
}
],
"status": "success",
"metrics": {
"elapsedTime": "91.843686ms",
"executionTime": "91.770049ms",
"resultCount": 1,
"resultSize": 4296
}
}
Indexes for the query
CREATE INDEX `idx_product_type_clientId` ON `mybucket`(`clientId`) WHERE (`form` = "product_type") USING GSI
CREATE INDEX `idx_product_type_slug` ON `mybycjet`((`values`.`slug`)) WHERE (`form` = "product_type") USING GSI
CREATE INDEX `idx_product_type_form` ON `mubucket`(`form`) WHERE (`form` = "product_type") USING GSI
- For this particular query, doc is less than 50KB
- just one.
Update: We rebuilt all indexes. We are not getting the error anymore, but I would like to know what caused this error. It was such an unexpected behavior. Is there a way to prevent it next time?
We currently have 34 million documents in our bucket.