Suppose that I have a user table, where each user has a status.

TABLE user_info {
  name        username;
  uint64_t    status = 0;
  auto        primary_key() const { return username.value; }
typedef multi_index<name("users"), user_info> users_table;
users_table _users;

Now in my frontend code, how would I get the status values for a list of 10 users? It doesn't make sense to send 10 independent get_table_rows queries to the blockchain. It also doesn't make sense to read the whole users table. What can I do?

UPDATE: currently I am doing this, but not sure if this is the most efficient way to do it:

const rpc = new JsonRpc(process.env.REACT_APP_EOS_HTTP_ENDPOINT);
for (var i=0; i< userList.length; i++) {
 const res = await rpc.get_table_rows({
  "lower_bound": userList[i],
  "upper_bound": userList[i],
results[i] = res.rows[0];

1 Answer 1


All rows in multi-index table are sorted by primary key in ascending order. If you call get_table_rows, it will return first 10 rows by default. You can pass limit to change the number of returned rows, and set the range of primary keys by lower_bound and upper_bound for returned rows.

  • thanks, but the list of users can be random, i.e. get the status value of 10 random users. I have actually achieved it using a for loop, but I am thinking maybe that's like making 10 independent calls to the blockchain. I was hoping to make one call and specify the records (a list of primary keys) and get the results back. Or maybe it is what is happening behind the scene. See the updated question please Feb 11, 2021 at 15:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.