You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
CREATE VERTEX TYPE Node;
CREATE VERTEX TYPE Entity EXTENDS Node;
CREATE PROPERTY Node.id STRING;
CREATEINDEXIF NOT EXISTS ON Node (id) UNIQUE;
CREATE VERTEX Entity SET id ='foo-1';
CREATE VERTEX Entity SET id ='foo-2';
The inherited index is usable for Node. Trying to create a same-named index on the child type:
CREATEINDEXIF NOT EXISTS ON Entity (id) UNIQUE;
does not create a separate direct Entity index: the inherited Node[id] index is treated as already covering the property, so a child-type index cannot coexist with it.
Execution plans
For SQL:
EXPLAIN SELECTFROM Entity WHERE id IN ['foo-1', 'foo-2'];
the plan uses the inherited index and then filters by the concrete type:
FETCH FROM INDEX Node[id]
FILTER ITEMS BY TYPE Entity
By contrast, querying the parent type uses an index seek:
EXPLAINMATCH (e:Node) WHEREe.idIN $idsRETURNe.id
NodeIndexSeek(e:Node)
Expected behavior
OpenCypher should use the inherited Node[id] index for an Entity query, as SQL does, and then filter results by the concrete Entity type. Alternatively, ArcadeDB should provide a workable mechanism for a concrete child-type index that can coexist with the inherited parent-type index.
Actual behavior and impact
OpenCypher performs a full label scan for the child type, including when the predicate is an equality/IN lookup that could use the inherited index. Repeated lookups by ID therefore grow with the number of records of the child type and can become a significant performance bottleneck.
Source investigation lead
In 26.8.1, the following implementation difference appears relevant:
Your analysis was right: Cypher only looked at the indexes a type declares itself, so MATCH (e:Entity) WHERE e.id = ... found none and fell back to a full label scan, while SQL had always used the inherited Node[id] index. Cypher now uses it too, and filters the result down to the concrete type - the same thing the SQL plan shows as FILTER ITEMS BY TYPE. Your repro plans as NodeIndexSeek now instead of NodeByLabelScan, for the equality, IN and parameter forms alike. MERGE on a child type benefits too, and that one was a correctness matter: it could previously match a record of a sibling type instead of creating one.
On the second half of your report - a child index that coexists with the parent's: that refusal is deliberate (#4083). Replacing an inherited index implicitly would silently take it away from the parent type. With the seek working there is no need for the duplicate anyway: an index on the parent already covers every child's records, which is exactly why the child one is reported as redundant.
❤️ Thanks for helping make ArcadeDB better! ArcadeDB is free and open source, sustained by its community. If it's useful to you or your company, please consider becoming a sponsor to keep development going.
Activity
fix(engine) #7021: OpenCypher seeks an index inherited from a parent …
Merge pull request #7024 from ArcadeData/fix/6996-7021-7017-batch
lvca commentedon Sep 2, 2026
Fixed in #7024, released with 26.9.1.
Your analysis was right: Cypher only looked at the indexes a type declares itself, so
MATCH (e:Entity) WHERE e.id = ...found none and fell back to a full label scan, while SQL had always used the inheritedNode[id]index. Cypher now uses it too, and filters the result down to the concrete type - the same thing the SQL plan shows asFILTER ITEMS BY TYPE. Your repro plans asNodeIndexSeeknow instead ofNodeByLabelScan, for the equality,INand parameter forms alike.MERGEon a child type benefits too, and that one was a correctness matter: it could previously match a record of a sibling type instead of creating one.On the second half of your report - a child index that coexists with the parent's: that refusal is deliberate (#4083). Replacing an inherited index implicitly would silently take it away from the parent type. With the seek working there is no need for the duplicate anyway: an index on the parent already covers every child's records, which is exactly why the child one is reported as redundant.
❤️ Thanks for helping make ArcadeDB better! ArcadeDB is free and open source, sustained by its community. If it's useful to you or your company, please consider becoming a sponsor to keep development going.