mirror of https://gitee.com/bigwinds/arangodb
160 lines
3.6 KiB
Plaintext
160 lines
3.6 KiB
Plaintext
arangosh> db._create("test");
|
|
[ArangoCollection 482014091, "test" (type document, status loaded)]
|
|
arangosh> for (i = 0; i < 100; ++i) { db.test.save({ value: i }); }
|
|
arangosh> db.test.ensureSkiplist("value");
|
|
{
|
|
"id" : "test/502002571",
|
|
"type" : "skiplist",
|
|
"fields" : [
|
|
"value"
|
|
],
|
|
"unique" : false,
|
|
"sparse" : false,
|
|
"isNewlyCreated" : true,
|
|
"code" : 201
|
|
}
|
|
arangosh> stmt = db._createStatement("FOR i IN test FILTER i.value > 97 SORT i.value RETURN i.value");
|
|
[object ArangoStatement]
|
|
arangosh> stmt.explain();
|
|
{
|
|
"plan" : {
|
|
"nodes" : [
|
|
{
|
|
"type" : "SingletonNode",
|
|
"dependencies" : [ ],
|
|
"id" : 1,
|
|
"estimatedCost" : 1,
|
|
"estimatedNrItems" : 1
|
|
},
|
|
{
|
|
"type" : "IndexRangeNode",
|
|
"dependencies" : [
|
|
1
|
|
],
|
|
"id" : 9,
|
|
"estimatedCost" : 48,
|
|
"estimatedNrItems" : 47,
|
|
"database" : "_system",
|
|
"collection" : "test",
|
|
"outVariable" : {
|
|
"id" : 0,
|
|
"name" : "i"
|
|
},
|
|
"ranges" : [
|
|
[
|
|
{
|
|
"variable" : "i",
|
|
"attr" : "value",
|
|
"lowConst" : {
|
|
"bound" : 97,
|
|
"include" : false,
|
|
"isConstant" : true
|
|
},
|
|
"highConst" : {
|
|
"include" : false,
|
|
"isConstant" : true
|
|
},
|
|
"lows" : [ ],
|
|
"highs" : [ ],
|
|
"valid" : true,
|
|
"equality" : false
|
|
}
|
|
]
|
|
],
|
|
"index" : {
|
|
"type" : "skiplist",
|
|
"id" : "502002571",
|
|
"unique" : false,
|
|
"sparse" : false,
|
|
"fields" : [
|
|
"value"
|
|
]
|
|
},
|
|
"reverse" : false
|
|
},
|
|
{
|
|
"type" : "CalculationNode",
|
|
"dependencies" : [
|
|
9
|
|
],
|
|
"id" : 5,
|
|
"estimatedCost" : 95,
|
|
"estimatedNrItems" : 47,
|
|
"expression" : {
|
|
"type" : "attribute access",
|
|
"name" : "value",
|
|
"subNodes" : [
|
|
{
|
|
"type" : "reference",
|
|
"name" : "i",
|
|
"id" : 0
|
|
}
|
|
]
|
|
},
|
|
"outVariable" : {
|
|
"id" : 4,
|
|
"name" : "3"
|
|
},
|
|
"canThrow" : false,
|
|
"expressionType" : "attribute"
|
|
},
|
|
{
|
|
"type" : "ReturnNode",
|
|
"dependencies" : [
|
|
5
|
|
],
|
|
"id" : 8,
|
|
"estimatedCost" : 142,
|
|
"estimatedNrItems" : 47,
|
|
"inVariable" : {
|
|
"id" : 4,
|
|
"name" : "3"
|
|
}
|
|
}
|
|
],
|
|
"rules" : [
|
|
"move-calculations-up",
|
|
"move-filters-up",
|
|
"remove-redundant-calculations",
|
|
"remove-unnecessary-calculations",
|
|
"move-calculations-up-2",
|
|
"move-filters-up-2",
|
|
"use-index-range",
|
|
"remove-filter-covered-by-index",
|
|
"use-index-for-sort"
|
|
],
|
|
"collections" : [
|
|
{
|
|
"name" : "test",
|
|
"type" : "read"
|
|
}
|
|
],
|
|
"variables" : [
|
|
{
|
|
"id" : 6,
|
|
"name" : "5"
|
|
},
|
|
{
|
|
"id" : 4,
|
|
"name" : "3"
|
|
},
|
|
{
|
|
"id" : 2,
|
|
"name" : "1"
|
|
},
|
|
{
|
|
"id" : 0,
|
|
"name" : "i"
|
|
}
|
|
],
|
|
"estimatedCost" : 142,
|
|
"estimatedNrItems" : 47
|
|
},
|
|
"warnings" : [ ],
|
|
"stats" : {
|
|
"rulesExecuted" : 34,
|
|
"rulesSkipped" : 0,
|
|
"plansCreated" : 1
|
|
}
|
|
}
|