arangodb/python-arango

Different statistics

rosenberg12 opened this issue · 2 comments

I have a problem. I want to get the count of my documents inside a certian collection. If I am calling <collection>.statistics() I get a different count than when I do the query RETURN LENGTH(students) directly in ArangoDB.

  • Why is the document size different?
  • What is indexes count and indexes size ?
from arango import ArangoClient

# Initialize the ArangoDB client.
client = ArangoClient()

# Connect to database as  user.
db = client.db(<db>, username=<username>, password=<password>)

print(db.collections())
students = db.collection('students')
print(student.statistics())
# [OUT]
# {'indexes': {'count': 5, 'size': 3466753}, 'documents_size': 12470373, 'cache_in_use': False, 'cache_size': 0, 'cache_usage': 0}

Directly in ArangoDB under QUERIES

RETURN LENGTH(students)

Hi @rosenberg12,

The size field from statistics() shows the size of the documents in bytes if I remember correctly. For document count, you want to use len(students) instead.

Thank you very much for your help! :)