# Scanning a large range with Locality API hangs

**URL:** <https://forums.foundationdb.org/t/scanning-a-large-range-with-locality-api-hangs/2183>\
**Category:** Using FoundationDB\
**Created:** [June 15, 2020, 1:08pm UTC](https://forums.foundationdb.org/t/scanning-a-large-range-with-locality-api-hangs/2183 "2020-06-15T13:08:44Z")\
**Posts on this page:** 1\
**Showing post:** 2

<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:** [June 15, 2020, 1:14pm UTC](https://forums.foundationdb.org/t/scanning-a-large-range-with-locality-api-hangs/2183/2 "2020-06-15T13:14:10Z")

</div>

I’m not sure about boundaryKeysIter behavior, but scanning large amount of data is quite common pattern. You will find lot of discussions around it in the forum. For example see this for one of the approaches:

> [@Large Range Scans - avoid 5s limit](https://forums.foundationdb.org/t/large-range-scans-avoid-5s-limit/292/10):
>
> Here is the almost complete code snippet that I currently use for this purpose. It should be straight forward to extend/update it: // input byte[] start, byte[] end, boolean reverse final AtomicReference\<byte[]\> seen = new AtomicReference\<\>(null); fdb.readAsync(tx -\> { // DO: Set timeout, num retries on the transaction object (tx) byte[] en = end; byte[] st = start; if (reverse) { en = seen.get() != null ? seen.get() : end; } else { // Note: nextKey is merg…

---

_[View the full topic](https://forums.foundationdb.org/t/scanning-a-large-range-with-locality-api-hangs/2183)._
