When using a Store by only appending data to the right, with constantly increasing key values of type Long, would it be best to query the Store's size using Store.count(..) before calling Store.putRight(..) every time and use that value as the next key? I was wondering if the store method could become quite expensive.
Store.count()
is quite cheap, as it requires only the tree root to be loaded, and its record in the database is highly likely loaded in the Log cache. Store.putRight()
compared to Store.put()
is cheaper under any workload as it results in less random access.