Thanks for all the responses.
@jmorris; I yes subsequent queries are MUCH faster and related to the metrics (ie less sdk/network latency) in the below example,
I see that the first call:
a1 = 55ms with metrics of 13ms = 32 ms delta
The second call takes
a2 = 13ms with metrics of 12ms = 1 ms delta
This is all on primary index, so once I’ve properly indexed my data it should be quite fast
sw.Reset();
sw.Start();
var query2 = bucket.Query<dynamic>("SELECT * FROM default WHERE type = 'Sport'");
sw.Stop();
var a1 = sw.ElapsedMilliseconds;
sw.Reset();
sw.Start();
var query3 = bucket.Query<dynamic>("SELECT type FROM default WHERE playerName = '1'");
sw.Stop();
var a2 = sw.ElapsedMilliseconds;
Not sure I will continue with Linq2couchbase as it increases to a 200ms for the below query which is a fair bit more overhead… I’m obviously doing something wrong…
var query = (from sportlist in db.Query() select sportlist.SportName).ToList();
Same thing again though; second query is MUCH faster… 17ms. so seems that the majority of the lag is due to the initial caching and I suppose initialising the connections? Does that sound right to you all based on the above?
Last thing, do you all just pass around your Ibucketcontext object to the functions that need it if it werent present within that function? I haven’t found a method to get a current open context on a bucket…
FYI:
Below is a comparison Niql and linq2couchbase… they seem equivalent… what components could the slowdown be? I think linq2cb needs to construct an object for the result mapping could that be it?
{
“#operator”: “Sequence”,
“~children”: [
{
“#operator”: “PrimaryScan”,
“index”: “#primary”,
“keyspace”: “default”,
“namespace”: “default”,
“using”: “gsi”
},
{
“#operator”: “Parallel”,
“~child”: {
“#operator”: “Sequence”,
“~children”: [
{
“#operator”: “Fetch”,
“as”: “Extent1”,
“keyspace”: “default”,
“namespace”: “default”
},
{
“#operator”: “Filter”,
“condition”: “((Extent1
.type
) = "Sport")”
},
{
“#operator”: “InitialProject”,
“result_terms”: [
{
“as”: “result”,
“expr”: “(Extent1
.sportName
)”
}
]
},
{
“#operator”: “FinalProject”
}
]
}
}
]
}
{
“requestID”: “0fa134eb-0c07-4724-afa0-c4aa5ca7e608”,
“signature”: “json”,
“results”: [
{
“#operator”: “Sequence”,
“~children”: [
{
“#operator”: “PrimaryScan”,
“index”: “#primary”,
“keyspace”: “default”,
“namespace”: “default”,
“using”: “gsi”
},
{
“#operator”: “Parallel”,
“~child”: {
“#operator”: “Sequence”,
“~children”: [
{
“#operator”: “Fetch”,
“keyspace”: “default”,
“namespace”: “default”
},
{
“#operator”: “Filter”,
“condition”: “((default
.type
) = "Sport")”
},
{
“#operator”: “InitialProject”,
“result_terms”: [
{
“expr”: “(default
.sportName
)”
}
]
},
{
“#operator”: “FinalProject”
}
]
}
}
]
}
]