My English is not good, please forgive me!
I create a new Buckets and insert abount 700,000 records.
Then I create 2 indexes in the buckets as follow:
CREATE PRIMARY INDEX ON did_devices USING GSI;
CREATE INDEX idx_system on did_devices
(SYSTEM
);
then, I get a query as follow:
cbq> select * from did_devices
where SYSTEM
= IOS1
limit 3;
{
“requestID”: “b061fcc2-c13d-421a-987e-7f2355830f61”,
“signature”: {
"": ""
},
“results”: [
],
“status”: “success”,
“metrics”: {
“elapsedTime”: “1m18.017465565s”,
“executionTime”: “1m18.01730557s”,
“resultCount”: 0,
“resultSize”: 0
}
}
show explain:
cbq> explain select * from did_devices
where SYSTEM
= IOS1
limit 3;
{
“requestID”: “64e6ecfe-3ba0-4991-8569-f04708cc5fdd”,
“signature”: “json”,
“results”: [
{
"#operator": “Sequence”,
"~children": [
{
"#operator": “Sequence”,
"~children": [
{
"#operator": “IndexScan”,
“index”: “idx_system”,
“keyspace”: “did_devices”,
“limit”: 9.223372036854776e+18,
“namespace”: “default”,
“spans”: [
{
“Range”: {
“High”: null,
“Inclusion”: 1,
“Low”: [
“null”
]
},
“Seek”: null
}
],
“using”: “gsi”
},
{
"#operator": “Parallel”,
"~child": {
"#operator": “Sequence”,
"~children": [
{
"#operator": “Fetch”,
“keyspace”: “did_devices”,
“namespace”: “default”
},
{
"#operator": “Filter”,
“condition”: “((did_devices
.SYSTEM
) = (did_devices
.IOS1
))”
},
{
"#operator": “InitialProject”,
“result_terms”: [
{
“star”: true
}
]
},
{
"#operator": “FinalProject”
}
]
}
}
]
},
{
"#operator": “Limit”,
“expr”: “3”
}
]
}
],
“status”: “success”,
“metrics”: {
“elapsedTime”: “3.90946ms”,
“executionTime”: “3.783982ms”,
“resultCount”: 1,
“resultSize”: 2605
}
}
I want to know why my query cost more then 1 minute while using index?
It is looks like the index is work!
thank you very much!