orientdb: Incorrect result from count query

OrientDB Version: 2.23

Java Version: 1.8.0

OS: freeBSD 10.3

I have encountered strange result during “count” query. Im not sure if this is actual bug or just my misunderstanding.

Expected behavior

count * and count rid should have equal number.

Actual behavior

These queries are in 2.2.23.

select count(@rid) from transactions  -  792743
select count(*) from transactions  -  1276958

I thought rid can never be null ? I even check if there is any record that rid is NULL but there is none.

select * from transactions where @rid is NULL  -  nothing

Then I realized we just upgraded ordb from 2.2.4 to 2.2.23. So I went back to query in 2.2.4 if it works correctly.

select count(*) from transactions  -  1276958
select count(@rid) from transactions  -  810532

Notice count(rid) result from v2.2.4 is not even equal to result from v2.2.23.

Steps to reproduce

I don’t know how this happen.

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 46 (24 by maintainers)

Most upvoted comments

@Bankde check database also should check database consistency if you use a distribution from an official site. The output should be like following:

Scanning 8049 edges (skipEdges=0)...
Scanning edges completed
Scanning 809 vertices...
Scanning vertices completed
Check of graph 'plocal:../databases/GratefulDeadConcerts' completed in 0 secs
 scannedEdges.....: 8049
 edgesToRemove....: 0
 scannedVertices..: 809
 scannedLinks.....: 16098
 linksToRemove....: 0
 verticesToRepair.: 0

Checking storage.Check of storage is started...Check of storage completed in 23ms.  without errors.
Checking indexes.
Checking cluster ofunction  for index OFunction.name
cluster ofunction (6) |********************| 100%
Total errors found on indexes: 0