Hi Rouven,
I had put aside what I was working on here and now picked it up again and did a whole lot of reading on it and got some better understanding now.
So I get now what a Neo4j Result object is and that .consume() turns it into a Neo4j Result Summary object which has an attribute profile which is the dictionary I am after.
Now I have updated Neo4j Server and Python Driver, i.e. I run
Neo4j Server: 4.4.35 (will update to 5.x sometime soon)
Neo4j Python Driver: 5.22.0
and the problem still persists. I am now using the Offshore Leaks dataset and still get the same issue running queries like
PROFILE MATCH (e:Entity) WHERE
e.service_provider IS NOT NULL AND e.sourceID IS NOT NULL AND e.valid_until IS NOT NULL
RETURN e.name
Here, the profile of the Neo4j Result Summary is a None object.
If, however, I add a COUNT, i.e. I run
PROFILE MATCH (e:Entity) WHERE
e.service_provider IS NOT NULL AND e.sourceID IS NOT NULL AND e.valid_until IS NOT NULL
RETURN COUNT(e.name)
it works and my Neo4j Result Summary object has a profile attribute which is a dictionary. The same seems to be the case when using DISTINCT instead of COUNT or any other aggregate function and I just cannot understand why this happens.
In addition, I have ran both queries above in Neo4j Browser and looked at the summary
there and pasted them below:
Neo4j summary for query without COUNT (causing issues / profile is None)
{
"query": {
"text": "PROFILE MATCH (e:Entity) WHERE\r\ne.service_provider IS NOT NULL AND e.sourceID IS NOT NULL AND e.valid_until IS NOT NULL\r\nRETURN e.name",
"parameters": {}
},
"queryType": "r",
"counters": {
"_stats": {
"nodesCreated": 0,
"nodesDeleted": 0,
"relationshipsCreated": 0,
"relationshipsDeleted": 0,
"propertiesSet": 0,
"labelsAdded": 0,
"labelsRemoved": 0,
"indexesAdded": 0,
"indexesRemoved": 0,
"constraintsAdded": 0,
"constraintsRemoved": 0
},
"_systemUpdates": 0
},
"updateStatistics": {
"_stats": {
"nodesCreated": 0,
"nodesDeleted": 0,
"relationshipsCreated": 0,
"relationshipsDeleted": 0,
"propertiesSet": 0,
"labelsAdded": 0,
"labelsRemoved": 0,
"indexesAdded": 0,
"indexesRemoved": 0,
"constraintsAdded": 0,
"constraintsRemoved": 0
},
"_systemUpdates": 0
},
"plan": {
"operatorType": "ProduceResults@neo4j",
"identifiers": [
"e",
"e.name
"
],
"arguments": {
"GlobalMemory": {
"low": 176,
"high": 0
},
"planner-impl": "IDP",
"Memory": {
"low": 0,
"high": 0
},
"runtime": "PIPELINED",
"runtime-impl": "PIPELINED",
"version": "CYPHER 4.4",
"DbHits": {
"low": 0,
"high": 0
},
"Details": "e.name
",
"PipelineInfo": "Fused in Pipeline 0",
"planner-version": "4.4",
"runtime-version": "4.4",
"EstimatedRows": 101793.125,
"planner": "COST",
"Rows": {
"low": 344086,
"high": 0
}
},
"children": [
{
"operatorType": "Projection@neo4j",
"identifiers": [
"e",
"e.name
"
],
"arguments": {
"Details": "e.name AS e.name
",
"EstimatedRows": 101793.125,
"PipelineInfo": "Fused in Pipeline 0",
"DbHits": {
"low": 688172,
"high": 0
},
"Rows": {
"low": 344086,
"high": 0
}
},
"children": [
{
"operatorType": "Filter@neo4j",
"identifiers": [
"e"
],
"arguments": {
"Details": "e.service_provider IS NOT NULL AND e.sourceID IS NOT NULL AND e.valid_until IS NOT NULL",
"EstimatedRows": 101793.125,
"PipelineInfo": "Fused in Pipeline 0",
"DbHits": {
"low": 2534775,
"high": 0
},
"Rows": {
"low": 344086,
"high": 0
}
},
"children": [
{
"operatorType": "NodeByLabelScan@neo4j",
"identifiers": [
"e"
],
"arguments": {
"Details": "e:Entity",
"Memory": {
"low": 112,
"high": 0
},
"PipelineInfo": "Fused in Pipeline 0",
"Time": {
"low": 929736870,
"high": 0
},
"PageCacheMisses": {
"low": 0,
"high": 0
},
"EstimatedRows": 814345,
"DbHits": {
"low": 814346,
"high": 0
},
"Rows": {
"low": 814345,
"high": 0
},
"PageCacheHits": {
"low": 3421046,
"high": 0
}
},
"children":
}
]
}
]
}
]
},
"profile": {
"operatorType": "ProduceResults@neo4j",
"identifiers": [
"e",
"e.name
"
],
"arguments": {
"GlobalMemory": {
"low": 176,
"high": 0
},
"planner-impl": "IDP",
"Memory": {
"low": 0,
"high": 0
},
"runtime": "PIPELINED",
"runtime-impl": "PIPELINED",
"version": "CYPHER 4.4",
"DbHits": {
"low": 0,
"high": 0
},
"Details": "e.name
",
"PipelineInfo": "Fused in Pipeline 0",
"planner-version": "4.4",
"runtime-version": "4.4",
"EstimatedRows": 101793.125,
"planner": "COST",
"Rows": {
"low": 344086,
"high": 0
}
},
"dbHits": 0,
"rows": 344086,
"pageCacheMisses": 0,
"pageCacheHits": 0,
"pageCacheHitRatio": 0,
"time": 0,
"children": [
{
"operatorType": "Projection@neo4j",
"identifiers": [
"e",
"e.name
"
],
"arguments": {
"Details": "e.name AS e.name
",
"EstimatedRows": 101793.125,
"PipelineInfo": "Fused in Pipeline 0",
"DbHits": {
"low": 688172,
"high": 0
},
"Rows": {
"low": 344086,
"high": 0
}
},
"dbHits": 688172,
"rows": 344086,
"pageCacheMisses": 0,
"pageCacheHits": 0,
"pageCacheHitRatio": 0,
"time": 0,
"children": [
{
"operatorType": "Filter@neo4j",
"identifiers": [
"e"
],
"arguments": {
"Details": "e.service_provider IS NOT NULL AND e.sourceID IS NOT NULL AND e.valid_until IS NOT NULL",
"EstimatedRows": 101793.125,
"PipelineInfo": "Fused in Pipeline 0",
"DbHits": {
"low": 2534775,
"high": 0
},
"Rows": {
"low": 344086,
"high": 0
}
},
"dbHits": 2534775,
"rows": 344086,
"pageCacheMisses": 0,
"pageCacheHits": 0,
"pageCacheHitRatio": 0,
"time": 0,
"children": [
{
"operatorType": "NodeByLabelScan@neo4j",
"identifiers": [
"e"
],
"arguments": {
"Details": "e:Entity",
"Memory": {
"low": 112,
"high": 0
},
"PipelineInfo": "Fused in Pipeline 0",
"Time": {
"low": 929736870,
"high": 0
},
"PageCacheMisses": {
"low": 0,
"high": 0
},
"EstimatedRows": 814345,
"DbHits": {
"low": 814346,
"high": 0
},
"Rows": {
"low": 814345,
"high": 0
},
"PageCacheHits": {
"low": 3421046,
"high": 0
}
},
"dbHits": 814346,
"rows": 814345,
"pageCacheMisses": 0,
"pageCacheHits": 3421046,
"pageCacheHitRatio": 1,
"time": 929736870,
"children":
}
]
}
]
}
]
},
"notifications": ,
"server": {
"address": "localhost:11005",
"agent": "Neo4j/4.4.35",
"protocolVersion": 4.4
},
"resultConsumedAfter": {
"low": 1054,
"high": 0
},
"resultAvailableAfter": {
"low": 13,
"high": 0
},
"database": {
"name": "neo4j"
}
}
Neo4j summary for query with COUNT (not causing issues / profile is dictionary)
{
"query": {
"text": "PROFILE MATCH (e:Entity) WHERE\r\ne.service_provider IS NOT NULL AND e.sourceID IS NOT NULL AND e.valid_until IS NOT NULL\r\nRETURN COUNT(e.name)",
"parameters": {}
},
"queryType": "r",
"counters": {
"_stats": {
"nodesCreated": 0,
"nodesDeleted": 0,
"relationshipsCreated": 0,
"relationshipsDeleted": 0,
"propertiesSet": 0,
"labelsAdded": 0,
"labelsRemoved": 0,
"indexesAdded": 0,
"indexesRemoved": 0,
"constraintsAdded": 0,
"constraintsRemoved": 0
},
"_systemUpdates": 0
},
"updateStatistics": {
"_stats": {
"nodesCreated": 0,
"nodesDeleted": 0,
"relationshipsCreated": 0,
"relationshipsDeleted": 0,
"propertiesSet": 0,
"labelsAdded": 0,
"labelsRemoved": 0,
"indexesAdded": 0,
"indexesRemoved": 0,
"constraintsAdded": 0,
"constraintsRemoved": 0
},
"_systemUpdates": 0
},
"plan": {
"operatorType": "ProduceResults@neo4j",
"identifiers": [
"COUNT(e.name)
"
],
"arguments": {
"GlobalMemory": {
"low": 208,
"high": 0
},
"planner-impl": "IDP",
"Memory": {
"low": 0,
"high": 0
},
"runtime": "PIPELINED",
"Time": {
"low": 19300,
"high": 0
},
"runtime-impl": "PIPELINED",
"version": "CYPHER 4.4",
"DbHits": {
"low": 0,
"high": 0
},
"Details": "COUNT(e.name)
",
"PipelineInfo": "In Pipeline 1",
"planner-version": "4.4",
"runtime-version": "4.4",
"PageCacheMisses": {
"low": 0,
"high": 0
},
"EstimatedRows": 1,
"planner": "COST",
"Rows": {
"low": 1,
"high": 0
},
"PageCacheHits": {
"low": 0,
"high": 0
}
},
"children": [
{
"operatorType": "EagerAggregation@neo4j",
"identifiers": [
"COUNT(e.name)
"
],
"arguments": {
"Details": "COUNT(cache[e.name]) AS COUNT(e.name)
",
"Memory": {
"low": 32,
"high": 0
},
"PipelineInfo": "Fused in Pipeline 0",
"EstimatedRows": 1,
"DbHits": {
"low": 0,
"high": 0
},
"Rows": {
"low": 1,
"high": 0
}
},
"children": [
{
"operatorType": "Filter@neo4j",
"identifiers": [
"e"
],
"arguments": {
"Details": "e.service_provider IS NOT NULL AND e.sourceID IS NOT NULL AND e.valid_until IS NOT NULL",
"EstimatedRows": 101793.125,
"PipelineInfo": "Fused in Pipeline 0",
"DbHits": {
"low": 2534750,
"high": 0
},
"Rows": {
"low": 344086,
"high": 0
}
},
"children": [
{
"operatorType": "NodeIndexScan@neo4j",
"identifiers": [
"e"
],
"arguments": {
"Details": "BTREE INDEX e:Entity(name) WHERE name IS NOT NULL, cache[e.name]",
"Memory": {
"low": 112,
"high": 0
},
"PipelineInfo": "Fused in Pipeline 0",
"Time": {
"low": 1372108270,
"high": 0
},
"PageCacheMisses": {
"low": 0,
"high": 0
},
"EstimatedRows": 814345,
"DbHits": {
"low": 814321,
"high": 0
},
"Rows": {
"low": 814320,
"high": 0
},
"PageCacheHits": {
"low": 3682043,
"high": 0
}
},
"children":
}
]
}
]
}
]
},
"profile": {
"operatorType": "ProduceResults@neo4j",
"identifiers": [
"COUNT(e.name)
"
],
"arguments": {
"GlobalMemory": {
"low": 208,
"high": 0
},
"planner-impl": "IDP",
"Memory": {
"low": 0,
"high": 0
},
"runtime": "PIPELINED",
"Time": {
"low": 19300,
"high": 0
},
"runtime-impl": "PIPELINED",
"version": "CYPHER 4.4",
"DbHits": {
"low": 0,
"high": 0
},
"Details": "COUNT(e.name)
",
"PipelineInfo": "In Pipeline 1",
"planner-version": "4.4",
"runtime-version": "4.4",
"PageCacheMisses": {
"low": 0,
"high": 0
},
"EstimatedRows": 1,
"planner": "COST",
"Rows": {
"low": 1,
"high": 0
},
"PageCacheHits": {
"low": 0,
"high": 0
}
},
"dbHits": 0,
"rows": 1,
"pageCacheMisses": 0,
"pageCacheHits": 0,
"pageCacheHitRatio": 0,
"time": 19300,
"children": [
{
"operatorType": "EagerAggregation@neo4j",
"identifiers": [
"COUNT(e.name)
"
],
"arguments": {
"Details": "COUNT(cache[e.name]) AS COUNT(e.name)
",
"Memory": {
"low": 32,
"high": 0
},
"PipelineInfo": "Fused in Pipeline 0",
"EstimatedRows": 1,
"DbHits": {
"low": 0,
"high": 0
},
"Rows": {
"low": 1,
"high": 0
}
},
"dbHits": 0,
"rows": 1,
"pageCacheMisses": 0,
"pageCacheHits": 0,
"pageCacheHitRatio": 0,
"time": 0,
"children": [
{
"operatorType": "Filter@neo4j",
"identifiers": [
"e"
],
"arguments": {
"Details": "e.service_provider IS NOT NULL AND e.sourceID IS NOT NULL AND e.valid_until IS NOT NULL",
"EstimatedRows": 101793.125,
"PipelineInfo": "Fused in Pipeline 0",
"DbHits": {
"low": 2534750,
"high": 0
},
"Rows": {
"low": 344086,
"high": 0
}
},
"dbHits": 2534750,
"rows": 344086,
"pageCacheMisses": 0,
"pageCacheHits": 0,
"pageCacheHitRatio": 0,
"time": 0,
"children": [
{
"operatorType": "NodeIndexScan@neo4j",
"identifiers": [
"e"
],
"arguments": {
"Details": "BTREE INDEX e:Entity(name) WHERE name IS NOT NULL, cache[e.name]",
"Memory": {
"low": 112,
"high": 0
},
"PipelineInfo": "Fused in Pipeline 0",
"Time": {
"low": 1372108270,
"high": 0
},
"PageCacheMisses": {
"low": 0,
"high": 0
},
"EstimatedRows": 814345,
"DbHits": {
"low": 814321,
"high": 0
},
"Rows": {
"low": 814320,
"high": 0
},
"PageCacheHits": {
"low": 3682043,
"high": 0
}
},
"dbHits": 814321,
"rows": 814320,
"pageCacheMisses": 0,
"pageCacheHits": 3682043,
"pageCacheHitRatio": 1,
"time": 1372108270,
"children":
}
]
}
]
}
]
},
"notifications": ,
"server": {
"address": "localhost:11005",
"agent": "Neo4j/4.4.35",
"protocolVersion": 4.4
},
"resultConsumedAfter": {
"low": 1375,
"high": 0
},
"resultAvailableAfter": {
"low": 11,
"high": 0
},
"database": {
"name": "neo4j"
}
}
They both seem to have a profile and things look fine as far as I can tell. So why does in Neo4j Browser the Summary look fine, but in Python one time the Neo4j Summary object seems to have no profile attribute and another time it does.
Thank you for any pointers you might be able to provide.
Cheers,
Philipp