When is outdegree updated?

Suppose a relationship VertexA -()- VertexB. 1 week ago I deleted some vertices of type VertexB, therefore making some VertexA orphan. And indeed, I can check that it I use neighbors function. However, if I query for all vertices VertexA with outdegree == 0, I get zero results (query example below). And it has been like this for over 1 week.

I know that vertex function outdegree() reads from a pre-calculated metadata.
So my question is: when is it updated? Or how can I update it?

  orphan_vertices = SELECT v FROM VertexA:v WHERE v.outdegree() == 0;
  PRINT orphan_vertices.size(); 

I am using Tigergraph 3.9.2

@mlikoga In TigerGraph, the outdegree of a vertex is typically calculated at query time and is not stored as pre-calculated metadata. Therefore, you shouldn’t encounter a situation where the outdegree remains incorrect for an extended period of time.

My first thought would be to verify the consistency of your data. Ensure that the deletion of VertexB instances indeed led to orphaned VertexA instances.

When you run a SELECT statement with VertexA -()- VertexB and then print the size does that return the same result of zero?

I am 100% sure the data is correct and there are orphaned VertexA. As I said, if I use the neighbors() function, like WHERE v.neighbors().size() == 0 I get multiple results.

So if outdegree should be updated, it’s likely a bug in Tigergraph.

For future reference, I found the answer. The outdegree documentation now has a caution box that reads:

Note on outdegree(): This function reads a metadata value stored with each vertex, to avoid traversing the graph and thus have a fast response. The snapshot transaction semantics means that outdegree() may sometimes read an old value if there are concurrent write transactions. To guarantee an accurate count, traverse the neighboring edges and count them with a SumAccum, or use a function like neighbors() and then use size() on the set.

So please ignore the previous answer from Tigergraph Team, as it is totally wrong. The correct answer to my question of “when is outdegree updated?” is the following from another Tigergraph member (and verified by me):

The outdegree() function is based on snapshot data (i.e. the data persisted to disk).

The segment rebuild is the process that persists the latest changes to data from memory to disk. The segment rebuild runs every 30 seconds, but only one segment at a time…so may take a while.

So you can trigger a rebuild of all segments via GraphStudio [or API]:
Actions :: GraphStudio and Admin Portal

Once the rebuild is complete…that is when you can verify the results.