How to find out the size of a RethinkDB table?

I cannot figure out how to get the data size of the test.events table.

r.db('rethinkdb').table('stats').whatGoesHere()
// Output size of 'events' table

Related: Get Rethinkdb Database Size Using Python

+4
source share
2 answers

This list will indicate the space allocated on the HDD for all nodes of the RethinkDB cluster:

r.db("rethinkdb")
  .table("stats")
  .filter({db:'test', table:'events'})
  .map(doc => doc('storage_engine')('disk')('space_usage')('data_bytes').default(0))
  .sum()

Alternatively, to display table sizes in MB:

r.db("rethinkdb").table("stats")
  .hasFields('db', 'table')
  .group('db', 'table')
  .map(doc => doc('storage_engine')('disk')('space_usage')('data_bytes').default(0))
  .sum()
  .ungroup()
  .map(doc => ({db: doc('group').nth(0), table: doc('group').nth(1), size: doc('reduction').div(1024).div(1024)}));
+5
source

You can call .count()for this.

0
source

Source: https://habr.com/ru/post/1613698/


All Articles