# Capacity Planning - indexes

**URL:** <https://discuss.aerospike.com/t/capacity-planning-indexes/1221>\
**Category:** Planning\
**Tags:** secondary, primary, index\
**Created:** [April 27, 2015, 12:15pm UTC](https://discuss.aerospike.com/t/capacity-planning-indexes/1221 "2015-04-27T12:15:27Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Doug](https://avatars.discourse-cdn.com/v4/letter/d/dbc845/32.png) [@Doug](https://discuss.aerospike.com/u/Doug)\
**Post date:** [April 27, 2015, 12:15pm UTC](https://discuss.aerospike.com/t/capacity-planning-indexes/1221/1 "2015-04-27T12:15:27Z")

</div>

When doing a memory calculation for indexes, are both primary and secondary records used in the calculation on a given node, or just primary records?

[https://www.aerospike.com/docs/operations/plan/capacity/](https://www.aerospike.com/docs/operations/plan/capacity/)

Thanks, Douglas

---

<div class="post-metadata">

**Author:** ![kporter](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.aerospike.com/kporter/32/515_2.png) [@kporter](https://discuss.aerospike.com/u/kporter)\
**Post date:** [April 28, 2015, 7:25pm UTC](https://discuss.aerospike.com/t/capacity-planning-indexes/1221/2 "2015-04-28T19:25:21Z")

</div>

There is a section for calculating size of primary index and another section for calculating size of secondary indexes.

You would need to calculate both.

---

<div class="post-metadata">

**Author:** ![Doug](https://avatars.discourse-cdn.com/v4/letter/d/dbc845/32.png) [@Doug](https://discuss.aerospike.com/u/Doug)\
**Post date:** [April 28, 2015, 8:04pm UTC](https://discuss.aerospike.com/t/capacity-planning-indexes/1221/3 "2015-04-28T20:04:09Z")

</div>

My question is are secondary **records** indexed in the primary and secondary indexes.

So for parameter R in the secondary index calculation (R - number of records/objects indexed in the secondary index). Is it all the records on the node, or is it just the primary records on the node.

From looking at the stats for the namespace it looks like the primary index takes up space for both primary and secondary records, whereas the secondary indexes seem to only contain primary records.

---

<div class="post-metadata">

**Author:** ![kporter](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.aerospike.com/kporter/32/515_2.png) [@kporter](https://discuss.aerospike.com/u/kporter)\
**Post date:** [April 28, 2015, 8:56pm UTC](https://discuss.aerospike.com/t/capacity-planning-indexes/1221/4 "2015-04-28T20:56:41Z")

</div>

The primary index is an index on all records in a namespace. Records indexed by a secondary index will be a subset of the primary index.

---

<div class="post-metadata">

**Author:** ![Doug](https://avatars.discourse-cdn.com/v4/letter/d/dbc845/32.png) [@Doug](https://discuss.aerospike.com/u/Doug)\
**Post date:** [April 29, 2015, 12:14pm UTC](https://discuss.aerospike.com/t/capacity-planning-indexes/1221/5 "2015-04-29T12:14:42Z")

</div>

I’m now good on the behaviour of primary indexes.

For secondary indexes. If you have a Set in a namespace that has a replication factor of 2, meaning roughly half the records will be considered primary for a given DB instance, and the other half will be secondary records. If all records in that set have a value for an indexed bin. Will both the primary and secondary records be indexed on that DB instance. Or will only the records the node considers primary be indexed.

---

<div class="post-metadata">

**Author:** ![kporter](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.aerospike.com/kporter/32/515_2.png) [@kporter](https://discuss.aerospike.com/u/kporter)\
**Post date:** [April 29, 2015, 6:05pm UTC](https://discuss.aerospike.com/t/capacity-planning-indexes/1221/6 "2015-04-29T18:05:27Z")

</div>

Both copies are indexed by secondary indexes.

---

<div class="post-metadata">

**Author:** ![Doug](https://avatars.discourse-cdn.com/v4/letter/d/dbc845/32.png) [@Doug](https://discuss.aerospike.com/u/Doug)\
**Post date:** [May 4, 2015, 1:09pm UTC](https://discuss.aerospike.com/t/capacity-planning-indexes/1221/7 "2015-05-04T13:09:44Z")

</div>

Thanks. The reason why I asked that was that I am always seeing a value that is significantly below the average calculation for a secondary string index (when I do stat namespace in aql).

---

<div class="post-metadata">

**Author:** ![kporter](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.aerospike.com/kporter/32/515_2.png) [@kporter](https://discuss.aerospike.com/u/kporter)\
**Post date:** [May 4, 2015, 10:46pm UTC](https://discuss.aerospike.com/t/capacity-planning-indexes/1221/8 "2015-05-04T22:46:50Z")

</div>

Which value? Could you provide output?
