# API to get wallet and metadata without reading entire account from DB

**URL:** <https://forum.heroiclabs.com/t/api-to-get-wallet-and-metadata-without-reading-entire-account-from-db/694>\
**Category:** Local Setup\
**Created:** [May 2, 2020, 4:49pm UTC](https://forum.heroiclabs.com/t/api-to-get-wallet-and-metadata-without-reading-entire-account-from-db/694 "2020-05-02T16:49:31Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![xnnnk](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/xnnnk/32/232_2.png) [@xnnnk](https://forum.heroiclabs.com/u/xnnnk)\
**Post date:** [May 2, 2020, 4:49pm UTC](https://forum.heroiclabs.com/t/api-to-get-wallet-and-metadata-without-reading-entire-account-from-db/694/1 "2020-05-02T16:49:31Z")

</div>

The only way to get wallet or metadata from an account (AFAIK) is to get the entire account using `AccountGetId` method.

In most cases that I have encountered, I only need wallet or metadata from an account. Other fields rarely change.  
So I think it is better to have an API that only gets wallet (or metadata) from database instead of all the fields.

---

<div class="post-metadata">

**Author:** ![novabyte](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/novabyte/32/1324_2.png) [@novabyte](https://forum.heroiclabs.com/u/novabyte)\
**Post date:** [May 2, 2020, 9:09pm UTC](https://forum.heroiclabs.com/t/api-to-get-wallet-and-metadata-without-reading-entire-account-from-db/694/2 "2020-05-02T21:09:32Z")

</div>

@xnnnk The player wallet is stored in the same table row as the rest of the player record. The database row scan will read 2KB tuples (block size) in a single read so there’s zero performance improvement or optimization to be gained with another API function to fetch just the wallet.

You could add a small helper function to your code which would achieve the ergonomics you’re looking for?

---

<div class="post-metadata">

**Author:** ![xnnnk](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/xnnnk/32/232_2.png) [@xnnnk](https://forum.heroiclabs.com/u/xnnnk)\
**Post date:** [May 2, 2020, 9:11pm UTC](https://forum.heroiclabs.com/t/api-to-get-wallet-and-metadata-without-reading-entire-account-from-db/694/3 "2020-05-02T21:11:26Z")

</div>

Dang it. I thought it could provide some performance improvement since over-selecting is _usually_ a bad practice. If it doesn’t make a difference, then it’s all good.

---

<div class="post-metadata">

**Author:** ![novabyte](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/novabyte/32/1324_2.png) [@novabyte](https://forum.heroiclabs.com/u/novabyte)\
**Post date:** [May 3, 2020, 12:20pm UTC](https://forum.heroiclabs.com/t/api-to-get-wallet-and-metadata-without-reading-entire-account-from-db/694/4 "2020-05-03T12:20:40Z")

</div>

@xnnnk Typically you’re right and if the wallet had been stored under a separate table and joined to return the player record the optimization would have been worthwhile 👍 . When we designed the schema for that part of the Nakama API we knew that it’d be fetched together in most cases especially when its returned to game clients at game startup so we optimized for that use case. 🙂
