# How does Aerospike scan data efficiently using range filter?

**URL:** <https://discuss.aerospike.com/t/how-does-aerospike-scan-data-efficiently-using-range-filter/781>\
**Category:** Query & Indexing\
**Created:** [December 25, 2014, 9:50am UTC](https://discuss.aerospike.com/t/how-does-aerospike-scan-data-efficiently-using-range-filter/781 "2014-12-25T09:50:04Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![deepnighttwo](https://avatars.discourse-cdn.com/v4/letter/d/6a8cbe/32.png) [@deepnighttwo](https://discuss.aerospike.com/u/deepnighttwo)\
**Post date:** [December 25, 2014, 9:50am UTC](https://discuss.aerospike.com/t/how-does-aerospike-scan-data-efficiently-using-range-filter/781/1 "2014-12-25T09:50:04Z")

</div>

One key design of aerospike is using hash key to distribute requests evenly to all nodes in the cluster. As a HBase user, I think this is a good design to avoid hot point. But come with this design, the key are not stored physically in sequence and the scan will have to go though all keys of a set.

But from the Java Client API, I found range filter api like:

- range(String name, long begin, long end)
- range(String name, Value begin, Value end)

Wondering how range filter supported in a hash-key-store cluster.

- What is the start and end means here? Is it the origin key of record? How keys are compared? ( It need to be compared and sorted to have a sequence so that start and end can be used, right?)
- And how efficiently this range filter is? How could it works on a distributed-hash key set?

Thanks!

---

<div class="post-metadata">

**Author:** ![manigandham](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.aerospike.com/manigandham/32/58_2.png) [@manigandham](https://discuss.aerospike.com/u/manigandham)\
**Post date:** [December 26, 2014, 8:19pm UTC](https://discuss.aerospike.com/t/how-does-aerospike-scan-data-efficiently-using-range-filter/781/2 "2014-12-26T20:19:06Z")

</div>

You’re probably looking for the Query feature: [http://www.aerospike.com/docs/guide/query.html](http://www.aerospike.com/docs/guide/query.html)

Aerospike allows for secondary-indexes which you can define to then run equality queries (int, string) or range queries (int) on bin values.

There are also LDT or Large-Data-Type records that can support range queries on the List LDT. More about that here: [http://www.aerospike.com/docs/guide/ldt.html](http://www.aerospike.com/docs/guide/ldt.html)

---

<div class="post-metadata">

**Author:** ![deepnighttwo](https://avatars.discourse-cdn.com/v4/letter/d/6a8cbe/32.png) [@deepnighttwo](https://discuss.aerospike.com/u/deepnighttwo)\
**Post date:** [December 29, 2014, 4:17am UTC](https://discuss.aerospike.com/t/how-does-aerospike-scan-data-efficiently-using-range-filter/781/3 "2014-12-29T04:17:21Z")

</div>

got it. So the start and end is for the secondary index and is for the bin’s, not for primary index.

Thanks for your answer!

---

<div class="post-metadata">

**Author:** ![Mnemaudsyne](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.aerospike.com/mnemaudsyne/32/200_2.png) [@Mnemaudsyne](https://discuss.aerospike.com/u/Mnemaudsyne)\
**Post date:** [June 16, 2015, 7:53pm UTC](https://discuss.aerospike.com/t/how-does-aerospike-scan-data-efficiently-using-range-filter/781/4 "2015-06-16T19:53:56Z")

</div>


