Secondary index vs reference set

What are the pros and cons of using a secondary index on a set versus building a reference set, where the key of the reference set is the bin in the target set that I want to index on, and the value is the primary key of the record I want to query? Particularly, are there any performance/scalability gains/losses in choosing one approach over the other? The only notable thing I can think of is that secondary indices must be rebuilt upon node/Aerospike process restart.

I am not sure if you are maintaining a secondary index in the reference set. IF so, the performance and consistency will be worse for a manually maintained index.

Thanks for your response! Why would the performance be worse for the manually maintained index? Aren’t there performance gains in having a set over a secondary index, especially at scale?

I may not have fully understood how the reference set would be built, but, in case you had not seen it, version 5.6 introduced the ‘set-index’ feature. Is this something that would potentially help your use case?

© 2021 Copyright Aerospike, Inc. | All rights reserved. Creators of the Aerospike Database.