Skip to content

Instantly share code, notes, and snippets.

@gurisko
Created January 14, 2020 09:31
Show Gist options
  • Save gurisko/e311e2196a1c1b665c36d00475d6b96c to your computer and use it in GitHub Desktop.
Save gurisko/e311e2196a1c1b665c36d00475d6b96c to your computer and use it in GitHub Desktop.
ArangoDB issue #10582
127.0.0.1:8529@nimpee> c = db._collection("eLink"); /* use actual collection name here */
[ArangoCollection 1262901971, "eLink" (type edge, status loaded)]
127.0.0.1:8529@nimpee> db._explain('FOR r IN @@collection FILTER r._from == "vDevice/1740442563" RETURN r', { '@collection': c.name() });
Query String (69 chars, cacheable: true):
FOR r IN @@collection FILTER r._from == "vDevice/1740442563" RETURN r
Execution plan:
Id NodeType Est. Comment
1 SingletonNode 1 * ROOT
6 IndexNode 1 - FOR r IN eLink /* edge index scan */
5 ReturnNode 1 - RETURN r
Indexes used:
By Name Type Collection Unique Sparse Selectivity Fields Ranges
6 edge edge eLink false false 100.00 % [ `_from`, `_to` ] (r.`_from` == "vDevice/1740442563")
Optimization rules applied:
Id RuleName
1 use-indexes
2 remove-filter-covered-by-index
3 remove-unnecessary-calculations-2
127.0.0.1:8529@nimpee> print("count:", c.count());
count: 5068
127.0.0.1:8529@nimpee> print("figures:", c.figures());
figures: {
"indexes" : {
"count" : 3,
"size" : 621952
},
"documentReferences" : 0,
"waitingFor" : "-",
"alive" : {
"count" : 5068,
"size" : 1755200
},
"dead" : {
"count" : 38419,
"size" : 13270480,
"deletion" : 41353
},
"compactionStatus" : {
"message" : "skipped compaction because collection has no datafiles",
"time" : "2020-01-14T08:39:53Z",
"count" : 0,
"filesCombined" : 0,
"bytesRead" : 0,
"bytesWritten" : 0
},
"datafiles" : {
"count" : 0,
"fileSize" : 0
},
"journals" : {
"count" : 1,
"fileSize" : 33554432
},
"compactors" : {
"count" : 0,
"fileSize" : 0
},
"revisions" : {
"count" : 5068,
"size" : 883776
},
"lastTick" : 1746644715,
"uncollectedLogfileEntries" : 0
}
127.0.0.1:8529@nimpee> print("indexes", c.getIndexes(true));
indexes [
{
"fields" : [
"_key"
],
"figures" : {
"memory" : 589184,
"buckets" : [
{
"nrAlloc" : 4603,
"nrUsed" : 626
},
{
"nrAlloc" : 4603,
"nrUsed" : 690
},
{
"nrAlloc" : 4603,
"nrUsed" : 581
},
{
"nrAlloc" : 4603,
"nrUsed" : 627
},
{
"nrAlloc" : 4603,
"nrUsed" : 645
},
{
"nrAlloc" : 4603,
"nrUsed" : 647
},
{
"nrAlloc" : 4603,
"nrUsed" : 628
},
{
"nrAlloc" : 4603,
"nrUsed" : 624
}
],
"nrBuckets" : 8,
"totalUsed" : 5068
},
"id" : "eLink/0",
"name" : "primary",
"selectivityEstimate" : 1,
"sparse" : false,
"type" : "primary",
"unique" : true
},
{
"fields" : [
"_from",
"_to"
],
"figures" : {
"memory" : 24576,
"from" : {
"buckets" : [
{
"nrAlloc" : 64,
"nrUsed" : 0
},
{
"nrAlloc" : 64,
"nrUsed" : 0
},
{
"nrAlloc" : 64,
"nrUsed" : 0
},
{
"nrAlloc" : 64,
"nrUsed" : 0
},
{
"nrAlloc" : 64,
"nrUsed" : 0
},
{
"nrAlloc" : 64,
"nrUsed" : 0
},
{
"nrAlloc" : 64,
"nrUsed" : 0
},
{
"nrAlloc" : 64,
"nrUsed" : 0
}
],
"nrBuckets" : 8,
"totalUsed" : 0
},
"to" : {
"buckets" : [
{
"nrAlloc" : 64,
"nrUsed" : 0
},
{
"nrAlloc" : 64,
"nrUsed" : 0
},
{
"nrAlloc" : 64,
"nrUsed" : 0
},
{
"nrAlloc" : 64,
"nrUsed" : 0
},
{
"nrAlloc" : 64,
"nrUsed" : 0
},
{
"nrAlloc" : 64,
"nrUsed" : 0
},
{
"nrAlloc" : 64,
"nrUsed" : 0
},
{
"nrAlloc" : 64,
"nrUsed" : 0
}
],
"nrBuckets" : 8,
"totalUsed" : 0
}
},
"id" : "eLink/1",
"name" : "edge",
"selectivityEstimate" : 1,
"sparse" : false,
"type" : "edge",
"unique" : false
},
{
"deduplicate" : true,
"fields" : [
"_ci",
"type"
],
"figures" : {
"memory" : 8192,
"buckets" : [
{
"nrAlloc" : 64,
"nrUsed" : 0
},
{
"nrAlloc" : 64,
"nrUsed" : 0
},
{
"nrAlloc" : 64,
"nrUsed" : 0
},
{
"nrAlloc" : 64,
"nrUsed" : 0
},
{
"nrAlloc" : 64,
"nrUsed" : 0
},
{
"nrAlloc" : 64,
"nrUsed" : 0
},
{
"nrAlloc" : 64,
"nrUsed" : 0
},
{
"nrAlloc" : 64,
"nrUsed" : 0
}
],
"nrBuckets" : 8,
"totalUsed" : 0
},
"id" : "eLink/1747941260",
"name" : "idx_1655659561874358272",
"selectivityEstimate" : 1,
"sparse" : false,
"type" : "hash",
"unique" : false
}
]
127.0.0.1:8529@nimpee> db._query('FOR r IN @@collection FILTER r._from == "vDevice/1740442563" RETURN r', { '@collection': c.name() }).toArray();
[ ]
127.0.0.1:8529@nimpee> db._query('FOR r IN @@collection FILTER r._from LIKE "vDevice/1740442563" RETURN r', { '@collection': c.name() }).toArray();
[
{
"_key" : "1746637568",
"_id" : "eLink/1746637568",
"_from" : "vDevice/1740442563",
"_to" : "vDevice/1740484191",
"_rev" : "_Z2_rGja--w",
"type" : "cdp",
"srcIntName" : "Fa2/0",
"dstIntName" : "Et2/1",
"srcArrow" : 1,
"dstArrow" : 1,
"priority" : 1,
"_ci" : "vCollect/8dc9b04f-3684-4404-a81d-9c9b72543c24",
"srcMedia" : null,
"dstMedia" : null,
"primary" : true
},
{
"_key" : "1746639226",
"_id" : "eLink/1746639226",
"_from" : "vDevice/1740442563",
"_to" : "vDevice/1740484191",
"_rev" : "_Z2_rGMC--j",
"type" : "cef",
"srcIntName" : "Fa2/0.10",
"dstIntName" : "Et2/1.10",
"srcArrow" : 1,
"dstArrow" : 1,
"priority" : 2,
"wan" : null,
"_ci" : "vCollect/8dc9b04f-3684-4404-a81d-9c9b72543c24",
"srcIp" : "10.241.10.11",
"subnet" : "10.241.10.0/24",
"dstIp" : "10.241.10.12",
"dgw" : false
},
{
"_key" : "1746639400",
"_id" : "eLink/1746639400",
"_from" : "vDevice/1740442563",
"_to" : "vDevice/1740484191",
"_rev" : "_Z2_rGMG-_B",
"type" : "cef",
"srcIntName" : "Fa0/0",
"dstIntName" : "Et2/2",
"srcArrow" : 1,
"dstArrow" : 1,
"priority" : 2,
"wan" : null,
"_ci" : "vCollect/8dc9b04f-3684-4404-a81d-9c9b72543c24",
"srcIp" : "10.241.8.11",
"subnet" : "10.241.8.0/24",
"dstIp" : "10.241.8.12",
"dgw" : false
},
{
"_key" : "1746640674",
"_id" : "eLink/1746640674",
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment