UDF or secondary index

My current design includes two types of secondary indexes, one being a unique secondary index (data is unique, alternative primary key), and the other being a secondary non-unique index, used for range queries and equality queries in general.

My question is, due to the network round trips, should all my non-unique secondary indexes become UDF’s rather? Where should I draw the line on what should become a secondary index and what should become a UDF?

Secondary index by nature is a Datastructure and stateful. UDF is a Function and stateless. Can you elaborate with example how do you see non-unique sindex translating to UDF ??

– R

Hi Raj

I think you indirectly answered my question. It it safe to say that if I want a piece of stateful data from the db, I can use an index on a bin. But if I am looking to aggregate or modify that data in a function, rather than bring it over the wire and perform that in my code, use a UDF on the server because it its more efficient?

Jamiedavie,

Sorry I am still not clear about what is that you are trying to achieve.

You can definitely run aggregation UDF over the result of query (Secondary index query or scan) on the server side if that is what your questions is about.

– R