I got to know from the 2019 summit video that its possible to use ‘composite keys’ in aerospike. Where can I find the API reference and any examples? thank you -Vikrant
It’s really more of concatenating strings to keys. I don’t think there’s any official api usage or examples, but I can probably illustrate one… Say you had a key that stored a loose list of a users browsing history - say the key is “vikrantl”. If you wanted to extend the amount of data you could hold on the key past what one record could hold, you could potentially add some kind of metadata into that main key to say 'my other key is “vikrantl2”. Then you can toss data on to vikrantl2 key. There are problems with this example but thats the basic concept. Another use case for this is if you wanted to use XDR and avoid race conditions by appending the dc-name to the key.
Hope that helps!
Trust what Vikrant is looking for is if you have records such as: Last Name | State | Shoe Size as the 3 bins in the data, and record’s primary key is say some “userid”, Vikrant wants to query a specific lastname+state combination i.e. fetch all Gupta in CA. Building such composite keys out of data in bins is not possible in Aerospike. While the query is possible using Secondary Indexes and Predicate Filtering - this concept of “Composite Key” is not available - no APIs hence. What Albot is suggesting is using the primary key as: “Gupta:CA:userid” to store the record instead of “userid” and then use logic in application to batch read the records that are of interest. In this case, somewhere you will keep a count of total userids for “Gupta:CA” so you can build the list of keys to retrieve via batch read. i.e. [Gupta:CA:0, Gupta:CA:1, … Gupta:CA:xxx (last)]