Skip to content

SELECT/DELETE/count on a LIGHTWEIGHT edge type answer zero: the scan reads a bucket that by construction holds nothing #7477

Closed

Description

@lvca

Reported as discussion #7473: a 4.2M-vertex / 125M-row bulk load through GraphImporter into a CREATE EDGE TYPE CITE LIGHTWEIGHT logged Import complete: 4,243,018 vertices, 75,539,070 edges, and Studio then showed EDGES(0) / CITE 0 with select from CITE returning nothing.

The importer is not the problem

GraphBatch already honours the type's LIGHTWEIGHT declaration whatever its deprecated per-batch withLightEdges flag says, and the edges were connected: a GraphImporter run over a LIGHTWEIGHT edge source produces a graph whose vertices carry the edges and whose traversals return them.

What actually answered zero

A lightweight edge is a pair of pointers inside the two vertices and allocates no record, so the edge type's bucket is empty by construction - ALTER TYPE ... LIGHTWEIGHT is refused on a type that holds records, so it can never be anything else. Every read path that resolves edges by type name rather than by walking a vertex therefore answered zero on a graph holding 75 million of them:

  • SELECT FROM CITE - a bucket scan of a bucket that cannot hold anything.
  • SELECT count(*) FROM CITE - countType() counts records, of which there are none.
  • DELETE FROM CITE - silently deleted nothing.
  • SELECT FROM CITE WHERE @rid = ..., index and indexed-function plans - all address records that do not exist.
  • Studio's sidebar badge and type detail - printed that record count as the type's size, next to an import that had just reported 75M edges.
  • SELECT FROM schema:types never emitted lightweight/bidirectional/unique, so nothing downstream could tell that the 0 was by design. RemoteSchema has always read those three keys, so every edge type reached a remote client as a plain bidirectional non-unique one.

The Cypher planner already knew about the trap and declines its count push-down on such a type (#5071); SQL had no equivalent guard anywhere.

Fix

Scan the vertices that hold the edges when the target type (or a subtype) is lightweight, and keep every count consistent with what that scan returns.

Not covered

A type whose LIGHTWEIGHT declaration was later lifted holds both shapes and is not declared lightweight any more, so its surviving lightweight entries stay reachable only by traversal. TRAVERSE ... FROM <lightweight type> and the MATCH root-alias cost estimate still read the record count.

Activity

  1. added this to the 26.10.1 milestone on Sep 11, 2026
  2. self-assigned this
    on Sep 11, 2026
  3. added
    in progress
    on Sep 11, 2026
  4. added
    engine
    on Sep 11, 2026
  5. added 9 commits that reference this issue on Sep 11, 2026
  6. 8 remaining items

  7. added a commit that references this issue on Sep 11, 2026
  8. added a commit that references this issue on Sep 12, 2026
  9. removed
    in progress
    on Sep 12, 2026
  10. lvca commented on Sep 12, 2026

    @lvca
    MemberAuthor

    Fixed in 26.10.1 (PR #7478).

    What was wrong: a LIGHTWEIGHT edge is stored as a pair of pointers inside its two vertices - it has no record of its own. Every query that asked for the edges by type name looked in the place where records live, found it empty, and answered zero. So a graph holding millions of edges reported none.

    What works now:

    SELECT FROM CITE              -- returns the edges
    SELECT count(*) FROM CITE     -- agrees with the above
    DELETE FROM CITE              -- actually deletes them (it used to do nothing)

    Studio also labels such a type LIGHTWEIGHT instead of showing it as 0, and remote clients now see the type's real flags.

    Two things to know:

    If you declared an edge type LIGHTWEIGHT and thought your data had not loaded, it almost certainly had - upgrade and query it again.


    ❤️ 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.

  11. added a commit that references this issue on Sep 12, 2026
  12. added a commit that references this issue on Sep 13, 2026
  13. added 2 commits that reference this issue on Sep 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugenginesql

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions