# \[Java\] API to get only the keys?

**URL:** <https://forums.foundationdb.org/t/java-api-to-get-only-the-keys/972>\
**Category:** Using FoundationDB\
**Created:** [December 23, 2018, 2:22pm UTC](https://forums.foundationdb.org/t/java-api-to-get-only-the-keys/972 "2018-12-23T14:22:21Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![gaurav](https://avatars.discourse-cdn.com/v4/letter/g/b487fb/32.png) [@gaurav](https://forums.foundationdb.org/u/gaurav)\
**Post date:** [December 23, 2018, 2:22pm UTC](https://forums.foundationdb.org/t/java-api-to-get-only-the-keys/972/1 "2018-12-23T14:22:21Z")

</div>

Hi, is there an API (specifically in Java bindings), that can return only the keys for a given range? I do not care for values in a specific scenario, and the size of values will run into TBs.

---

<div class="post-metadata">

**Author:** ![ryanworl](https://sea1.discourse-cdn.com/foundationdb/user_avatar/forums.foundationdb.org/ryanworl/32/440_2.png) [@ryanworl](https://forums.foundationdb.org/u/ryanworl)\
**Post date:** [December 23, 2018, 2:46pm UTC](https://forums.foundationdb.org/t/java-api-to-get-only-the-keys/972/2 "2018-12-23T14:46:20Z")

</div>

This is something I too went looking for at one point and found to not exist. My remedy was to write two keys: one with the real data, and one as a pointer with the size of the value at the other end of the pointer.

The size may not be relevant for your use case, but I was using it to balance data volume among processing threads. I would read the pointer keys in one thread, then match the sizes up evenly with the available threads, then pass the ranges on to process in parallel.

---

<div class="post-metadata">

**Author:** ![gaurav](https://avatars.discourse-cdn.com/v4/letter/g/b487fb/32.png) [@gaurav](https://forums.foundationdb.org/u/gaurav)\
**Post date:** [December 23, 2018, 3:18pm UTC](https://forums.foundationdb.org/t/java-api-to-get-only-the-keys/972/3 "2018-12-23T15:18:08Z")

</div>

Yes, I do follow that approach.

However, in this case, I want to read those keys that have the `real data` as the value. The use-case is writing some validation tools, that can check that there are no `orphan` data rows (due to my application layer bugs). And I do not want to fetch the entire data value bytes, only to discard it immediately.
